65.9K
CodeProject is changing. Read more.
Home

Set height of a div to full screen

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.71/5 (7 votes)

Nov 6, 2011

CPOL
viewsIcon

74650

How to set the height of a div to full screen.

Here is how to set the height of a div to full screen:

min-height:expression( document.body.clientHeight +’px’);
If your website is jQuery enabled, the same can be achieved by:
$('#yourHtmlElementId').attr('height',$(window).height());
NOTE: The prime reason behind posting this trick was that 'height:100%;' does not work with IE 8 browser. So if any alternative is posted, I would request the authors to test it in IE 8 compatibility mode in IE 9.