IE float/positioning bug?

R

Ryan Stewart

In IE 6.0, I observe that if:
1) a box has a background color and a border and is relatively
positioned and,
2) a child of the box described in 1) is floated, and
3) the boxes are rendered such that the area of box 2) is within the
area of box 1),

then IE renders the child box behind the parent box. The code below
demonstrates the effect. Removing any one of the background color,
border, or "position: relative" will cause it to work as expected. Is
there some other known workaround?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1">
<title>Test</title>
<style type="text/css">
#container { background-color: #fff; border: 1px solid
black;
position: relative; }
#floating { float: left; }
</style>
</head>
<body>
<div id="container">
<div id="floating">
This is floated left
</div>
<p>
This is just some text
</p>
</div>
</body>
</html>
 
M

Martin Johansen

When something is positioned relative to its parent, the next box will
position itself first, which is appropriate.
 
R

rf

Ryan Stewart said:
In IE 6.0, I observe that if:
1) a box has a background color and a border and is relatively
positioned and,
2) a child of the box described in 1) is floated, and
3) the boxes are rendered such that the area of box 2) is within the
area of box 1),

then IE renders the child box behind the parent box.

Known bug.

The workaround it to specify position: relative; for the floated box.
 
R

Ryan Stewart

Martin Johansen said:
When something is positioned relative to its parent, the next box will
position itself first, which is appropriate.
Not sure what you're talking about, but Richard gave me a solution.
 
R

Ryan Stewart

rf said:
Known bug.

The workaround it to specify position: relative; for the floated box.
Thanks a bunch. And sorry for the formatting of that post. I posted it with
Google, and it removed a lot of spacing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top