gespinha
gespinha

Reputation: 8487

Problems with div not assuming total height

I am having some problems with this situation: http://jsfiddle.net/gespinha/wgWAx/4/

The JQuery alert should report the #parentDiv height, and, as you can see, its original height is 2000+ and not 532 as is displays.

This happens because its height is set to 100%, but how can I make this 100% mark the page height, or should I say, the original #parentDiv's height?

The #childDiv, should maintain its height, being the whole body height.

<div id="parentDiv">
    <header id="childDiv">
        <div id="anotherDiv"></div>
    </header>
    <div id="spaceDiv"></div>
</div>

Upvotes: 1

Views: 91

Answers (2)

Mangled
Mangled

Reputation: 329

remove the height:100% from html, body

Right now the body get's 100% of your view (try resizeing the window and refresh)

Upvotes: 0

neonKow
neonKow

Reputation: 29

Your jsfiddle works when you get rid of

html, body {
    height:100%;
}
body {
    width:100%;
}

Upvotes: 1

Related Questions