Click here to Skip to main content
12,450,101 members (46,228 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

62.5K views
15 bookmarked
Posted

Set height of a div to full screen

, 25 Dec 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

aspnet -i
Web Developer
India India
Software developer by profession, working for a service and product based organisation in India.

Career graph:
Software Programmer since 2002.
Web Developer in ASP.NET since 2004.

Interests:
I love reading the blogs and articles of technology experts. I love codeproject and stackoverflow .

I love to share knowledge and help the programmers. I appreciate if some body corrects my code or my concepts which helps me learn.

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralRe: Direct from Microsoft website ("About Dynamic Properties" ur... Pin
GladToBeGrey14-Nov-11 3:02
memberGladToBeGrey14-Nov-11 3:02 
GeneralThe prime reason behind posting this trick was that 'height:... Pin
B Birajdar1-Dec-11 3:45
memberB Birajdar1-Dec-11 3:45 
GeneralInsufficient info and it doesn't work Pin
joekecalo21-Nov-11 21:43
memberjoekecalo21-Nov-11 21:43 
Generalcan you tell how can we get the height of screen when we hav... Pin
spydeehunk7-Nov-11 16:48
memberspydeehunk7-Nov-11 16:48 
GeneralRe: Yes. The javascript will get the height of the client browse... Pin
B Birajdar7-Nov-11 22:35
memberB Birajdar7-Nov-11 22:35 
GeneralNot really, no. CSS expressions were unique to IE, and were... Pin
GladToBeGrey7-Nov-11 12:05
memberGladToBeGrey7-Nov-11 12:05 
GeneralRe: CSS expressions are still valid. I have tested it in IE 8 an... Pin
B Birajdar14-Nov-11 2:50
memberB Birajdar14-Nov-11 2:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160826.1 | Last Updated 25 Dec 2011
Article Copyright 2011 by aspnet -i
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid