View Full Version : Setting a division's height based on Screen Height.

01-26-2006, 11:27 PM

I'm needing to resize a <div> based on the height of a users screen, relative heights in css are not cutting the mustard.

What I would like is code to place in an external .js file that would detect the screen height, and By the elements ID set the height. I believe this would be the best way, if I am wrong, let me know, I need to know the best way to do this.

As always, dd community, thanks for all the help in advance!

01-27-2006, 04:15 AM
What if the browser is only occupying a small portion of the user's screen? In those situations do you still want to size the division relative to the user's screen height? In any case, if this is what you truly want to do:


or for only a portion of the screen height:


You can put this in an external .js file say - div_height.js and call it on your page just above the closing </body> tag:

<script src="div_height.js" type="text/javascript"></script>