我很抱歉英文写得不好:) 我尝试并排 float 两个 div,位置是固定的,我不想为它们使用百分比,这段代码对所有浏览器都很好显示,但即 6 不工作
HTML
<div class="right"></div>
<div class="top"></div>
<div class="main">
<div class="content"></div>
</div>
CSS
body{
margin-top: 0;
padding: 0;
width: 100%;
height: 100%;
position: relative;
}
.right{
width: 200px;
height: 100%;
float: right;
position: fixed;
right: 0;
top: 0;
bottom: 0;
background-color: #ccc;
z-index: 5;
}
.main{
position: fixed;
float: right;
height: 100%;
right: 200px;
left: 0;
bottom: 0;
top: 50px;
background-color: red;
display: inline;
z-index: 1;
}
.top{
position: fixed;
float: right;
right: 200px;
left: 0;
bottom: 0;
top: 0px;
background-color: yellow;
clear: left;
}
最佳答案
IE 6 在 float 问题上有双倍 margin ,如下所述:http://www.cssnewbie.com/double-margin-float-bug/#.Uoo6xflgfTQ
添加
display: inline;
到你的 float 元素来解决这个问题。
但是,在您的代码中,我看到您同时使用了 floats 和 position: fixed,
您可以完全删除所有 float ,这将在不更改布局的情况下解决问题。
关于css - 两个 div 位置固定和 float ,没有百分比宽度,但在 IE6 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20049646/