Wenlong Xu wrote:
> Hi, dear all,
> I have met a float problem in IE6/7.
>
> code:
> ----------------------------------------------------------------------------
>     <div id="1" style="background-color: #0f0;">
>         <div  style="float:left;height:30px;width:100%;">
>         </div>
>         <div style="clear:both;"></div>
>     </div>
>     <div  id="3" style="background-color: #f00;height:5px; margin: 0 
> 5px;"></div>
> ----------------------------------------------------------------------------
> it looks pretty good in FF3+/IE8, but in IE6/7  the #3 DIV seems to be inside 
> #1 DIV.
> is this a IE bug or something else? how to fix it?
>
> any reply will be helpful, thanks.
> Wenlong.
>
>
>   



It is not necessary to float the lime block. Consequently, it is not
necessary to clear the float. The html comment <!-- &#nbsp;--> simply
tells the software (specifically IE/6) that there is something "in" the
division(s).

Set it like this and compliant browsers, and even IE/6.0 and IE/7.0 will
be on-board:

<!doctype html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>abc</title>

<style type="text/css">

body {margin:0; background: #fff; color:#000;}
#a {background:lime;height:30px; width:100%;}
#b {background:red;height:5px; margin: 0 5px;}

</style>
</head>
<body>
<div id="a"><!-- &#nbsp;--></div>
<div id="b"><!-- &#nbsp;--></div>
</body>
</html>





______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to