3

This is how basically document looks like:

<body>
<div id="content_holder">
<div class='all_links'>
</div>
  <div class="item">
        <div class="notice"></div>
    </div>
</div>
<div id="bottom_nav">
</div>
</body>

And CSS:

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    }

body{
overflow-y:scroll;
min-width: 1024px;
}

#content_holder{
    min-height: 100%;
}

.item {
width: 800px;
position: relative;
top: 100px;
left: 50%;
margin-left: -400px;
text-align: center;
min-height: 100%;

}

The problem that on this specific page html, body, .item properties about min-height doesn't work in percents.

On other pages everything is OK. Parent of .item is body. I can't get what is wrong here. When I check height with Chrome Dev Tool, body height on this page is 360px, which, of course, twice less than it shoudl be.

Why?

UPD: fiddle

What I've found out, that height property doesn't work specifically for #content_holder, and works for body

Joe Half Face
  • 2,303
  • 1
  • 17
  • 45

2 Answers2

2


When height is set on any element in a percentage, it's immediate parent element must have height specified (not as a percentage, but in px or em).

The weird exception to that rule is the <html> element, which if it is given height: 100%, an immediate child element can then have height as a percentage (i.e. the <body> element).

As for setting min-height: 100%, this sets the initial size to 100% height and allows the element to exceed that height.

I'm pretty sure that min-height also follows the same above-mentioned rule for height -- for any element set with min-height in a percentage, its' immediate parent element must have height specified (not as a percentage), with the exception of the <html> element being set with height as a percentage.

However, if an element sets height as a px or em value, and its' immediate child element sets height as a percentage, the grandchild element's height can be set as a percentage, and so on...

Ian Campbell
  • 2,678
  • 10
  • 56
  • 104
1

Just change min-height: 100% to height: 100%.

The height of your webpage will be 100% of the browser screen, or 100% of the content height, whichever is bigger.

Chris Mukherjee
  • 841
  • 9
  • 25