I'm working on a website that have pages that exceed 100% browser window height
and ones that do not. So, what I need is the height to be at least 100%
but higher if applicable.
My current CSS
looks like:
html, body {
min-height: 100%;
height: auto;
}
This initially seemed to work fine but then I realized that <body>
does NOT have the same height
as <html>
but rather seems to use the standard height
. It is like <body>
does NOT respect the min-height
property.
Hopefully, someone can toss some ideas or shine some light on this.
UPDATE1 It seems like HTML is acting as if it was default too..
UPDATE2 http://jsfiddle.net/rpz4rd4c/5
UPDATE3 According to the suggested comment by ( MichaelHarvey ) the body height
is relative to the html height
( not min-height
) if that was true the following code should work:
html {
min-height: 100%;
height: auto;
}
body {
height: 100%;
}
However, it doesn't.
FINAL UPDATE
The solutions provided on this page "work" however they might be buggy with JS plugins. I would recommend people to use 100vh
solution or the one I accepted as answer ( mainly because it requires no CSS3
). I guess a 100% accurate solution to a problem like mine (having all dividers and elements 100% non-related to browser window) would be to simply use inline CSS
and use min-height
at longer pages and a height
at browser fitting ones. This might require some JS
.
<3