I want to make body have 100% of the browser height. Can I do that using CSS?
I tried setting height: 100%
, but it doesn't work.
I want to set a background color for a page to fill the entire browser window, but if the page has little content I get a ugly white bar at the bottom.
Try adding:
Here:
Please check this:
Or try new method Viewport height :
Viewport: If your using viewport means whatever size screen content will come full height fo the screen.
Here Update
Works for all major browsers: FF, Chrome, Opera, IE9+. Works with Background images and gradients. Scrollbars are available as content needs.
If you have a background image then you will want to set this instead:
This ensures that your body tag is allowed to continue growing when the content is taller than the viewport and that the background image continues to repeat/scroll/whatever when you start scrolling down.
Remember if you have to support IE6 you will need to find a way to wedge in
height:100%
for body, IE6 treatsheight
likemin-height
anyway.