简体   繁体   English

绝对定位元素裁剪,如果位置在其父项IE7之外

[英]absolute positioned element clipping if position outside its parent item IE7

Hi 你好

Im trying to position an element so its slightly positioned outside its parent item. 我试图定位一个元素,使其略微位于其父项之外。 In IE8 it works but in IE7 the positioned element gets clipped. 在IE8中它可以工作,但在IE7中,定位元素被剪裁。

Here's my code HTML: 这是我的代码HTML:

<div id="parent">
    <div id="child">text</div>
</div>

The CSS CSS

#parent {
height: 40px;
width: 400px;
position: relative;
}

#child {
position: absolute;
width: 100px;
height: 60px;
top: 0px;
left: 0px;
}

In IE7 you will see that the last 20px of the child element gets clipped. 在IE7中,您将看到子元素的最后20px被剪裁。 How can I solve this? 我怎么解决这个问题?

THX 谢谢

Its just the famous z-index bug for IE7 它只是IE7着名的z-index错误
The problem with IE7 is that it applies z-index=0 for all the positioned elements IE7的问题在于它对所有定位元素应用z-index = 0
ie elements with position != static has z-index=0. 即具有位置!= static的元素具有z-index = 0。
So eventually this stacking context that causes the issue 因此最终导致问题的堆叠上下文

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

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