Forum Moderators: not2easy

Message Too Old, No Replies

parent and child divs

do child divs "push" their parent divs heights or spill out of them?

         

schacko

4:38 am on Apr 25, 2008 (gmt 0)

10+ Year Member



hello, here's an example with multiple div elements

<div id=#parent>
<div id=#child1>content 1</div>
<div id=#child2>content 2</div>
</div>

- lets say #parent has a width property of 100%
- if #child1 and #child2 have 50% width and i fill #child1 with content, will the box of #child1 "push" on #parent extending #parent height?
- or will #child1 "spill" outward without affecting #parent?
- if #parent height IS extended, will #child2's height be extended also?

i have some mixed functionality between browsers and I'm wondering what the proper rendering is

hopefully this is understandable

- Shawn

g1smd

11:30 pm on Apr 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Which DOCTYPE do you use on those pages?

swa66

2:31 am on Apr 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I presume the 50% width means at least one of them is floated ?

Floated elements are taken out of the flow and do not take up height in their parent.

To get the parent to stretch, add something that stays in the flow of the parent and give it a "clear" (or from what I read (but never used intentionally) make the parent floated itself).

If you see IE do something else: IE broken (beyond repair apparently)