Hi all
I’m trying to understand clearing floats so I have the simple page where the containing div is cleared to stop it collapsing
Uncleared - http://www.ttmt.org.uk/overflow.html
cleared - http://www.ttmt.org.uk/overflow1.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>clearFloats</title>
<style type="text/css">
*{
margin:0;
padding:0;
}
body{
background:gray;
}
div.box{
background:#fff;
width:1000px;
overflow:hidden;
}
*html div.box{
height:1%;
}
div.box img{
border:1px solid red;
}
div.box p.desc{
float:right;
width:500px;
border:1px solid red;
}
</style>
</head>
<body>
<div class="box group">
<img src="images/pic1.jpg" alt="" />
<p class="desc">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
</p>
</div>
</body>
</html>
If I test in IE 6/7 the text will not float to the right side of the image and is positioned underneath on the right side with the containing div stretching the height of the image and text.
I changed the order of the html so the <img> appears after the <p> and it works in IE 6/7 as it does in other browsers.
http://www.ttmt.org.uk/overflow2.html
Should elements to be floated appear before other elements in a container ?
Is IE 6 still relevant enough to fix problems like this ?