2012-03-16 56 views
0

我有一个名为#info-box的div,我希望它有点透明。为了让这个div中的元素不透明,你必须对它们应用相对位置,并使它看起来好像它们在#info-box div中。这在Chrome中适用于我,但在Internet Explorer中,内容仅遵循正常流程。我究竟做错了什么? http://jsfiddle.net/kcqtj/1/在Internet Explorer中的相对定位

+0

您可能希望将那个小提琴修剪为基本元素和样式。 – steveax 2012-03-16 00:59:30

+0

该问题可能是由受影响元素之前的代码引起的 – user1174762 2012-03-16 01:03:06

回答

1

你可能想创建这样的东西(伪代码)。 non_transparent_child是实际的容器,而不是将其透明化,而是在它后面模拟transparent_child。它们全部包含在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; 
}