css - IE6 和 IE7 上的 float 问题

标签 css internet-explorer-7 css-float internet-explorer-6

我网站子部分的标题由 4 个垂直堆叠的 div 组成。第五个包含图像的 div float 在这 4 个 div 上方,离右边界稍远。此布局在 Firefox、IE8、Chrome 和其他浏览器上运行良好,但在 IE7 和 IE6 上,div 不会 float 在其他 div 上,从而弄乱了我的布局。我该如何解决这个问题?

HTML 就是这么简单:

<div class="inter_auth">
  <div class="inter_photo">
    <img name="" src="{{ uri options="image 1" }}" width="100" height="112" border="0" />
  </div>
  <div class="other_div1">
  </div>
  <div class="other_div2">
  </div>
  <div class="other_div3">
  </div>
  <div class="other_div4">
  </div>
</div>

容器 CSS 是:

.inter_auth { 
  width:315px; 
  background:#ffffff; 
  font-family: Verdana, Geneva, sans-serif; 
  font-size: 10px; 
  text-align:left; 
  min-height:1px;
  overflow:hidden;
  zoom:1; }

图像 CSS 是:

.inter_photo { 
  position:relative; 
  float:right; 
  margin:2px; 
  top:-2px; 
  left: -15px; 
  background:#899ca2; 
 *background-image: url(transparent.gif); }

最佳答案

相反,您可以尝试绝对定位元素。您的包装器 .inter_auth 应该相对定位,子 div 可以绝对定位在父 div 中。您应该能够使用 top、left、bottom 和 right 属性将它们精确对齐。这是一个 quick tutorial定位上。查看底部关于重叠元素的部分。

关于css - IE6 和 IE7 上的 float 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2500873/

相关文章:

javascript - 将动画脚本应用于不同的 Div/img

html - 其容器中的 Accordion "growing out"- 在 IE7/8 中

css - 在不影响文本的情况下创建 IE7 不透明背景

html - 如何将可扩展的 div 对齐到始终居中/居中的元素的一侧 - css

html - 当浏览器变小时尝试删除表格的第三列(CSS)

javascript - 如何测量使用 CSS3 变换缩放的 HTML 元素的高度?

javascript - 捆绑javascript/css

html - 在 IE7 中的表格中显示背景的一个像素

css - 无缝图像对齐,无论 CSS 的方向如何?

html - CSS 垂直对齐 : middle not working on nav bar with text to the left and login link to the right