如何让 div 背景图像显示在 img html 标记上方。想要这样做的原因是为了在横幅中覆盖旋转图像的半透明纹理。我不想每次都用图像切割纹理。这样将来添加/更新图像会更快。我已经尝试过这篇文章中给出的建议,但似乎没有用:CSS show div background image on top of other contains elements。谢谢你的帮助。
html:
<div id="sliderFrame">
<div id="slider">
<span id="slider-background">
<img src="/_images/rotating-banner/001.jpg" />
</span>
</div>
</div>
CSS:
#sliderFrame {position:relative;width:850px;margin: 0 auto;}
#slider {
width:850px;height:470px;/* Make it the same size as your images */
background:#fff url(/_images/marqueeLayout/loading.gif) no-repeat 50% 50%;
position:relative;
margin:0 auto;/*make the image slider center-aligned */
box-shadow: 0px 1px 5px #999999;
}
#slider-background{
position:absolute;
background: url(/_images/marqueeLayout/MarqueeTexture.png) no-repeat;
width: 850px;
height: 470px;
z-index: 100;
}
链接到现场网站: http: //lltc.designangler.com/