简体   繁体   English

在Internet Explorer中的相对定位

[英]Relative positioning in Internet Explorer

I have a div named #info-box which I want to be somewhat transparent. 我有一个名为#info-box的div,我希望它有点透明。 In order to have the elements in this div not be transparent, you have to apply a relative position to them and make it look as if they are in the #info-box div. 为了使该div中的元素不透明,必须对它们应用相对位置,并使它们看起来好像它们在#info-box div中。 This works fine for me in Chrome but in Internet Explorer the content just follows normal flow. 这对我在Chrome中正常工作,但在Internet Explorer中,内容仅遵循正常流程。 What am I doing wrong? 我究竟做错了什么? http://jsfiddle.net/kcqtj/1/ http://jsfiddle.net/kcqtj/1/

you might wanna create something like this (pseudo-code). 您可能想创建类似这样的东西(伪代码)。 the non_transparent_child is the actual container and instead of putting transparency to it, have a transparent_child behind it emulate it instead. non_transparent_child是实际容器而不是把透明的,有transparent_child背后模仿它来代替。 they are all contained in positioned_container which will be the one movable. 它们都包含在positioned_container ,它将是一个可移动的容器。

<wrapper>
    <positioned_container>       //parent that contains the two
        <transparent_child>      //this is your transparent stuff 
        <non_transparent_child>  //this will contain normal stuff
    </positioned_container>
</wrapper>

//relative so that the absolute children will be based from here
positioned_container{
    position:relative;
}

//set to stretch with the parent
transparent_child {
    position:absolute;
    top:0;
    bottom:0;
    left:0;
    right:0;
}

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

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