简体   繁体   English

IE6定位问题

[英]IE6 positioning issue

It works as intended in Safari, Firefox etc. But it is not reading the positioning or z-index in IE6. 它可以在Safari,Firefox等环境中正常工作。但是,它没有读取IE6中的位置或z-index。 How can I make it layout as it should in IE6? 如何在IE6中进行布局?

Here is the CSS: 这是CSS:

.AuthorName_Pic {
    width: 186px;
    position: absolute;
    right: 0;
    bottom: -120px;
    padding: 20px 10px 20px 15px;
    margin: 20px 0 0 0;
    background: url(images/ThumbDark.jpg) no-repeat;
    z-index:100;
}

You'll need to address the box model bug . 您需要解决box模型错误 I would use Tantek's solution . 我会使用Tantek的解决方案

  1. Ensure you are using Standards Mode not Quirks, otherwise the meaning of 'width' and 'height' is different in IE to other browsers. 确保您使用的是“ 标准模式”而不是“怪癖”,否则IE中“宽度”和“高度”的含义与其他浏览器不同。 This is the box model bug as mentioned by Josh, but you don't want to be using a Box Model Hack in this day and age (especially not Tantek's original-and-still-the-worst ugly one). 正如乔什(Josh)所提到的,这是盒模型错误,但是您希望在这个时代使用盒模型黑客(特别是不是Tantek最初最糟糕的丑陋版本)。 BMHs were needed for IE5 but today are dead and buried, as Standards Mode fixes that issue and a lot more. IE5需要BMH,但由于Standards Mode修复了该问题以及更多内容,今天已死定了。

  2. You say the z-index is wrong in some way. 您说z-index在某种程度上是错误的。 There isn't enough information to say for sure since you have only posted a small part of your code, but a common source of this problem is that IE sets a default 'z-index' stacking context on any element you give a 'position' (relative/absolute) even when you don't include the z-index attribute. 没有足够的信息可以肯定地说,因为您只发布了代码的一小部分,但是这个问题的一个共同根源是IE会在您赋予“位置”的任何元素上设置默认的“ z-index”堆叠上下文'(相对/绝对),即使您不包含z-index属性也是如此。 Ensure all the elements you have positioned are also z-indexed to ensure consistent layout cross-browser. 确保已定位的所有元素也都经过z索引,以确保跨浏览器的布局一致。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM