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.
If you want to keep the margins on the body and don't want scroll bars, use the following css:
Setting
body {min-height:100%}
will give you scroll bars.See demo at http://jsbin.com/aCaDahEK/2/edit?html,output .
all answers are 100% correct and well explained, but i did something good and very simple to make it responsive.
here the element will take 100% height of view port but when it comes to mobile view it don't look good specially on portrait view ( mobile ), so when view port is getting smaller the element will collapse and overlap on each other. so to make it little responsive here is code. hope someone will get help from this.
here is JSfiddle Demo.
Only with 1 line of CSS… You can get this done.
CSS3 has a new method.
It makes ViewPort 100% equal to the height.
So your Code should be
You can also use JS if needed
About the extra space at the bottom: is your page an ASP.NET application? If so, there is probably a wrapping almost everything in your markup. Don't forget to style the form as well. Adding
overflow:hidden;
to the form might remove the extra space at the bottom.