[thelist] css question...
rsusoeff
rsusoeff at afamily.net
Fri Nov 5 11:47:40 CST 2004
On Nov 4, 2004, at 3:10 PM, Travis wrote:
> I want to nest a div within a div like so...
> <div><div style="float:left; width:50%"></div></div>
> This works great in firefox, etc, but in ie the nested div is assigned 50%
the width of the entire page - not 50% the width of the parent div.
Interestingly, if I remove the float, it works fine. Unfortuneately I need
the float.
Travis,
Assign a fluid width to your containing <div>, thus:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<style type="text/css">
html,body {
background-color: #fff;
margin: 0;
padding: 0;
text-align: center;
}
#outerDiv {
background: red;
margin: 5% auto;
padding: 0;
width: 90%;
}
#outerDiv .half {
background: silver;
float: left;
margin: 0;
padding: 0;
width: 50%;
}
</style>
</head>
<body>
<div id="outerDiv"><div class="half">this is the float</div> </div>
</body>
</html>
HTH, Rick.
More information about the thelist
mailing list