Quote:
Originally Posted by M1kael
Thanks for the heads up. Although, my problem is only worse now, as it does not work for any browsers. Can anyone help me get this working correctly?
|
I figured it would be after you said you got it working in IE but not the other browsers. This is why again you getting working in a good browser and hack/tweak for IE. Try this
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Welcome!</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style TYPE="text/css">
html, body {
margin:0;
padding:0;
}
#container {
border: 1px solid #000;
}
#fixBox {
float: left;
width: 150px;
height: 100px;
border: 1px solid #000;
}
#dynamicBoxContainer {
border: 1px dotted #0f0;
margin-left:160px;
}
#dynamicBox {
margin-left: 8px;
float: left;
display:inline;
width: 23%;
height: 100px;
border: 1px solid #000;
}
.clear {
clear:both;
font-size:0;
line-height:0;
}
</style>
<!--[if lte IE 6]>
<style type="text/css">
#fixBox {
margin-right:-3px;
}
#dynamicBoxContainer {
margin-left:8px;
height:1%;
}
</style>
<![endif]-->
</head>
<body>
<div id="container">
<div id="fixBox"></div>
<div id="dynamicBoxContainer">
<div id="dynamicBox"></div>
<div id="dynamicBox"></div>
<div id="dynamicBox"></div>
<div id="dynamicBox"></div>
<div class="clear"> </div>
</div>
</div>
</body>
</html>
Compare it to what you have now. I didn't change much. Just a few widths. By default a block level element like a div takes up 100% width of its container. Explicitly setting the width and then adding the border makes it take up more than 100%. Borders add to overall width as does padding.
IE6 has this 3px gap bug explain here:
http://www.positioniseverything.net/...reepxtest.html
I've already implemented this into your code using
conditional comments.
I also fixed the double margin bug on #dynamicBox.
http://www.positioniseverything.net/...ed-margin.html