absolute positioned element clipping if position outside its parent item IE7

落花浮王杯 提交于 2019-12-14 00:57:53

问题


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.

Here's my code HTML:

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

The 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. How can I solve this?

THX


回答1:


Its just the famous z-index bug for IE7
The problem with IE7 is that it applies z-index=0 for all the positioned elements
i.e elements with position != static has z-index=0.
So eventually this stacking context that causes the issue



来源:https://stackoverflow.com/questions/2880363/absolute-positioned-element-clipping-if-position-outside-its-parent-item-ie7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!