IE6下与float元素相邻的position:absolute元素消失BUG

代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>IE6下与float元素相邻的position:absolute元素消失BUG</title>
<style type="text/css">
*
{ margin:0; padding:0}
.wrap
{ width:800px; height:200px; margin:0 auto; position:relative}
.left
{ width:300px; height:200px; background-color:#F00; float:left}
.right
{ width:500px; height:200px; background-color:#00F; float:left}
.pos
{ width:600px; height:30px; background-color:#000; color:#fff; position:absolute; left:0; top:0;}
.pos2
{ top:60px;}
</style>
</head>

<body>
<div class="wrap">
<div class="pos">如果不加下面的div,在IE6下是看不见我的</div>
<!--[if IE 6]><div></div><![endif]-->
<div class="left"></div>
<div class="right"></div>
<!--[if IE 6]><div></div><![endif]-->
<div class="pos pos2">如果不加上面的div,在IE6下是看不见我的,总之是要与浮动之间加个空的DIV</div>
</div>
</body>
</html>

 

posted @ 2011-01-26 18:00  Unintended  阅读(623)  评论(0编辑  收藏  举报