据我了解,当将透明度方面放在一个元素上时,不透明度始终保持在最上面。我的问题是:在不透明度之上放置元素的最佳方法是什么。
这是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>
这是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;
}
(为了进一步理解,这是视差项目的开始。这是为了学习此技术。)
像这样
因此,一种方法solution
是使用微小的透明材料PNG
作为重复的背景图像来解决此问题。唯一的问题是IE6,并且有此链接
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句