I have got a forum with the following HTML structure:
<div id="header">Contents</div>
<div id="main">Contents</div>
<div id="footer">Contents</div>
Basically, I need to set the height of #main
to the height of the document minus the height of the other 2 elements. The problem is I have to do it without jquery. I googled the problem and found the clientHeight method, but it returns the height as a number, while I need it as pixels.
So, the question is:
Is there any way to get the height in pixels in pure javascript?
Math.round
and add the string'px'
. But I agree to @evolutionxbox, a CSS solution would be cleaner. – Hallowed