css - 两个 div 位置固定和 float ,没有百分比宽度,但在 IE6 中不起作用

标签 css internet-explorer-6

我很抱歉英文写得不好:) 我尝试并排 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/

相关文章:

html - 获取 Google 文档 HTML 内容,然后使用 GmailApp 发送

Jquery 无法为事件链接以外的其他对象旋转下拉箭头

jquery - 健全性检查 : change event not firing first time using keyboard

html - 即 : Divs move when window is resized too small

css - 并排 float 两个div

ajax - 调试:IE6 + SSL + AJAX + post form = 404错误

CSS 页脚对齐问题

html - Font Awesome 列表填充

html - 如何更改 MetisMenu 下拉菜单的背景颜色和设置边距?

css - 中心 3 div 水平全屏