Calculate CSS box height by hand - Javascript CSS Style Property

Javascript examples for CSS Style Property:height

Description

Calculate CSS box height by hand

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from   w w w.  j a  v  a  2  s  .c  o m
var height= document.getElementById('test').offsetHeight;
console.log(height)
    }

      </script> 
   </head> 
   <body> 
      <div id="test" style="padding: 15px; background-color: #ccc; font-size: 18px; line-height: 1.4em;">
          text 
      </div>  
   </body>
</html>

Related Tutorials