IE7-/Win: incorrect shrink-wrapping in presence of hasLayout children

In the below test case a gray container wraps 3 divs: a green, an orange and a blue one.

  1. The container has float:left and width:auto, so it should shrink-wrap its contents. The same results occur with position:absolute, …
  2. The green child is the one with more content, this should "define" the width of the container.
  3. The orange child has hasLayout (given by an assigned height), the other two does not have hasLayout.
blah blah blah blah blah blah blah blah blah blah blah blah
one two
one two

In IE6- the presence of the hasLayout orange child prevents the shrink-wrapping effect on the container. In IE7 this has been corrected, but now the orange box incorrectly shrink wraps its content (i.e. it doesn't have the same width as its siblings.)

In the below test case hasLayout has been removed on the orange child, IE works correctly.

blah blah blah blah blah blah blah blah blah blah blah blah
one two
one two

CSS tests home

IE7 has other problems with shrink-to-fit containers. Below the orange box has width:50% (note that even width:100% doesn't fix the problem of the 'extra' shrink of the child.)

blah blah blah blah blah blah blah blah blah blah blah blah
i i i
one two

And now it has width:5% (it seems to use body as reference)

blah blah blah blah blah blah blah blah blah blah blah blah
i i i i i i i i i i i i i i i i i i i
one two

With a right float inside the container (shrink-wrapping of the container is lost)

blah blah blah blah blah blah blah blah blah blah blah blah
one two
one two

With a right float inside the hasLayout child (shrink-wrapping of the container is lost)

blah blah blah blah blah blah blah blah blah blah blah blah
one two
one two

With min-width: 50% assigned to the hasLayout child (shrink-wrapping of the container is lost)

blah blah blah blah blah blah blah blah blah blah blah blah
one two
one two

With min-width: 100% assigned to the hasLayout child (shrink-wrapping of the container is lost)

blah blah blah blah blah blah blah blah blah blah blah blah
one two
one two

CSS tests home