I have an outer div that is floated left, but no width is given to it
Then I have 2 divs that are within the outer div. When I float both the inner divs to left, the outer div is as wide as the sum of the inner divs in Chrome, Firefox and IE7.
When I float the first inner div to right, the width of the outer div is the same as above in Chrome/Firefox. But, I see a different behavior in IE7. The outer div is stretched 100% of the browser width in IE7.
Case 1 (both inner divs floated left)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>IE7</title>
</head>
<body>
<div style="background: yellow;float:left;padding: 10px;">
<div style="background: beige;height: 200px;width:100px;float:left;">
Inner 1
</div>
<div style="background: tan;float:left;padding: 10px;width: 400px;">
Inner 2
</div>
</div>
</body>
</html>
Case 2: First inner div is floated right
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>IE7</title>
</head>
<body>
<div style="background: yellow;float:left;padding: 10px;">
<div style="background: beige;height: 200px;width:100px;float:right;">
Inner 1
</div>
<div style="background: tan;float:left;padding: 10px;width: 400px;">
Inner 2
</div>
</div>
</body>
</html>
What am I doing wrong? Thanks in advance for the help.