CSS
-Tricks
treehouse :
what would you like to learn today?
Web Design
Web Development
iOS Development
Show search box
Search
Search in:
All
Articles
Forums
Snippets
Videos
✕
Home
Forums
Snippets
Gallery
Videos
Almanac
Demos
Lodge
Navigation 'n' Search
Forums
Illustration by Nick Sirotich
Forums
»
CSS Combat
'DIV' that takes up the height of the browser
djpic
Permalink to comment
#
April 2012
Hello,
I need to know if there is a way in CSS to make the height of a 'div' the same height as the brewer window? I have tried height of 100%, but of course that doesn't work. Any ideas?
cizmic
Permalink to comment
#
April 2012
Why didn't 100% work? Can you give me the code or result?
djpic
Permalink to comment
#
April 2012
Here is a quick demo of sort of what I want to do.
Your text to link...
cizmic
Permalink to comment
#
April 2012
Try using
html, body {
height: 100%;
}
That should fix it.
djpic
Permalink to comment
#
April 2012
Well, that worked....Thanks! I did try the body 100% by itself but didn't work. I guess you need the HTML as well. Any idea why you need both?
cizmic
Permalink to comment
#
April 2012
Because in browsers, the html tag is considered as a block element.
djpic
Permalink to comment
#
April 2012
Oh yes, of course, thanks.
Add a Comment
I need to know if there is a way in CSS to make the height of a 'div' the same height as the brewer window? I have tried height of 100%, but of course that doesn't work. Any ideas?
Your text to link...
html, body {
height: 100%;
}
That should fix it.