ScrollHeight
From XPUB & Lens-Based wiki
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style>
.box {
position: relative;
left: 50px;
top: 50px;
width: 600px;
height: 300px;
border: 5px solid red;
}
.layer {
position: absolute;
border: 5px solid green;
width: 100%;
height: 100%;
overflow: hidden;
}
p {
font-size: 50px;
margin: 0;
}
</style>
<script>
function add() {
p = document.createElement("p");
p.innerHTML = "hello";
document.getElementById("layer").appendChild(p);
}
</script>
</head>
<body>
<button onclick="add()">add</button>
<div class="box">
<div id="layer" class="layer">
</div>
</div>
</body>
</html>