How to stop IE8 from expanding a nested div's width to fit parent div?

Posted by Tony_Henrich on Stack Overflow See other posts from Stack Overflow or by Tony_Henrich
Published on 2010-04-13T19:09:30Z Indexed on 2010/04/13 19:13 UTC
Read the original article Hit count: 242

Filed under:
|

I have a page with several levels of divs. In one of the inner divs, there are two divs (1 & 2) which have float; left so that they are on the same horizontal level. It looks good in FireFox, but in the IE8, div 2 is below div 1. I turned the borders on and noticed div2 (violet border) is filling the width of the parent box. In FF, the width is the width of all the content only. If I use a hard coded width (not a good idea), IE8 displays it fine.

How can I make IE8 not expand the width of div2 to the right edge of its parent div?

IE8 (not good: div2 width is expanded) alt text

Firefox (good: width of div2 is not expanded) alt text

© Stack Overflow or respective owner

Related posts about css

Related posts about html