Forum Moderators: not2easy

Message Too Old, No Replies

Div in a Div

         

themeaty

5:20 pm on Feb 15, 2006 (gmt 0)

10+ Year Member



Hi, I have a div within a div.

<div id="master">
<div id="internal">
<img width="500" height="400">
</div>
</div>

The internal div is taller than the master div because of the image. But the master div does not expand to fully contain the internal div. The internal div overlaps the edge of the master div.

This screws up my layout. How do I get the master div to expand and contain the internal div? Please help this is frustrating me. Thanks!

DrDoc

5:25 pm on Feb 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld! [WebmasterWorld.com]

Well, there must be something in your CSS causing that. Perhaps your internal div is floated? If so, float the parent.

themeaty

5:48 pm on Feb 15, 2006 (gmt 0)

10+ Year Member



okay, thanks for your tip. That actually wasn't the solution but you made me think about another element that needed some changes to its CSS. Thanks!

DrDoc

5:51 pm on Feb 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What's the CSS like for your master and internal?

Fotiman

6:42 pm on Feb 15, 2006 (gmt 0)

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



If your outer div has a fixed height value (using CSS), then your inner one WILL "stick out" of it. You could float both the inner item and the outer item to make sure the outer item contained the inner item, or you could float the inner item, and include another element after it that clears the float, but you would not want to give the outer item a fixed height in those cases.