Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <style> #myDIV { margin-top: 10px; height: 250px; width: 250px; overflow: auto; } #content { height: 800px; width: 2000px; padding: 10px; background-color: coral; } </style> </head> <body> <p>Click the button to get the entire height (vertically) and width (horizontally) of the div element with id="content".</p> <button onclick="myFunction()">Try it</button> <div id="myDIV"> <div id="content">Some content..</div> </div> <p id="demo"></p> <script> function myFunction() { var elmnt = document.getElementById("content"); var y = elmnt.scrollHeight; var x = elmnt.scrollWidth; document.getElementById ("demo").innerHTML = "Height: " + y + "px<br>Width: " + x + "px"; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_element_scrollheight by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:29:00 GMT --> </html>
Result:
Try it Yourself - © w3schools.com