2012-03-16 59 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; 
}