topherg
topherg

Reputation: 4293

Getting the height of a relative div container

I have a DIV that contains lots of child DIV elements. The container DIV has the position attribute set to relative, and all the child elements have their position attributes set to absolute. Each of those has positional data set using top and left. I wish to add a footer after the container, but it's height is being registered as 0px. Is there a way to set it so that it's height will expand to encompass all the child elements (via CSS only, no javascript)?

Upvotes: 0

Views: 106

Answers (1)

Maujor
Maujor

Reputation: 263

CSS Specs says:

In the absolute positioning model, a box is explicitly offset with respect to its containing block. [1]

So, CSS can't expand the height of the container to encompass all the absolutely positioned DIV's

[1] http://www.w3.org/TR/CSS2/visuren.html#absolute-positioning

Upvotes: 1

Related Questions