ScrollHeight: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "<source lang="html4strict"> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <style> .box { position: relative; left: 50px; top: 50px; w...")
 
(No difference)

Latest revision as of 16:51, 4 December 2012

<!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>