0

It is my understanding that when one places the transparency aspect on an element, the opacity always remains on top. My question is: What is the best way to place an element on top of the opacity.

Here is the Jsfiddle: http://jsfiddle.net/6xV4B/

HTML:

<div id="header">
   <ul id="social" class="center">
       <li><a href="#"><img src="images/facebook.png" alt="Facebook Icon" /></a></li>
       <li><a href="#"><img src="images/twitter.png" alt="Twitter Icon" /></a></li>
       <li><a href="#"><img src="images/linkedIn.png" alt="linkedIn Icon" /></a></li>
    </ul>
</div>

<div id="backgroundOne">
    <div id="backgroundTwo" class="center"></div>
</div>

<div id="blankTile1"></div>

<div id="myPicture" class="center">
    <div id="logo"></div>
</div>

<div id="blanktileTwo"></div>

Here is the CSS:

#header {
    width: 100%;
    height: 250px;
    background-color: #643b0f;
    opacity: .5;
}
#social {
    width: 1050px;
    margin: 0 auto;
}
#social li {
    display: inline-block;
    margin: 50px 0 0 50px;
}
#social li a {
    padding: 0 50px;
}
#backgroundOne {
    width: 100%;
    height: 1200px;
    background-color: blue;
    background-repeat: no-repeat;
    background-size: cover;
}
#myPicture {
    width: 650px;
    height: 955px;
    margin: -1200px 0 0 325px;
    position: absolute;
    display: block;
    background-color: yellow;
}
#backgroundTwo {
    width: 960px;
    height: 1200px;
    background-color: #000;
    opacity: .5;
}
#logo {
    background-color: green;
}
#blankTile1 {
    width: 100%;
    height: 478px;
    background-color: transparent;
}
#blankTile2 {
    width: 100%;
    height: 478px;
    background-color: transparent;
}

(For further understanding - this is the beginning of a parallax project. This is in order to learn this technique.)

4

1 回答 1

1

像这样

所以,一个solution是使用一个微小的透明PNG作为重复的背景图像来解决这个问题。唯一的问题是 IE6,还有这个链接

于 2013-09-13T06:38:42.600 回答