主要是IE 注释BUG 去掉<!–xxxx–>相关注释
错误产生的原因和浮动也有关系,记得要关闭浮动的元素。注释的越多,溢出的字越多。
你也可以插入空的标记来解决!比如我下面放了个<p>元素
范例
<style type=”text/css”>
#layout{
margin: 0 auto;
width: 600px;
}
#main{
background: #FFEBCD;
float: left;
width: 400px;
height: 500px;
}
#right{
background: #6495ED;
float: left;
width: 200px;
height: 500px;
}
–>
</style>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
<!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" lang="zh-CN"> <head> <title></title> <style type="text/css"> #layout{ margin: 0 auto; width: 600px; } #main{ background: #FFEBCD; float: left; width: 400px; height: 500px; } #right{ background: #6495ED; float: left; width: 200px; height: 500px; } --> </style> </head> <body> <div id="layout"> <div id="main"></div> <!-- 注释 --> <!-- 注释 --> <!-- 注释 --> <!-- 注释 --> <!-- 注释 --> <div id="right">溢出溢出溢出溢出溢出溢出溢出溢出溢出溢出溢出溢出溢出溢出溢出溢出溢出溢出</div> </div> </body> </html> |