我正在尝试获取一个透明的 png 框架图像,将其悬停在 img 标签上,以在其上创建框架的外观。我尝试了多种不同的方法,但似乎都不起作用。
我使用的最新方法是http://www.cssbakery.com/2009/06/background-image.html http://www.cssbakery.com/2009/06/background-image.html这似乎也不起作用。
HTML
<div class="filler">
<div class="filler-picture">
<img src="../../media/img/test.jpg" alt="test" />
<div class="filler-mask"> </div>
</div>
</div>
CSS
.filler {
padding-left:20px;
height:361px;
width:559px;
float:left;
}
.filler-mask {
background: url('..img/filler.png') no-repeat;
position: absolute;
left:0; top:0;
height:361px;
width:559px;
}
.filler-picture {
z-index: 0;
background: url('..img/test.jpg') no-repeat;
position: relative;
height: 361px;
width: 559px;
display: block;
}
有谁知道为什么这不起作用。
你可以将 2 个绝对 div 放在具有不同 z-index 的填充图片下
<div class="filler">
<div class="filler-picture">
<div class="filler-img">
<img src="../../media/img/test.jpg" alt="test" />
</div>
<div class="filler-mask">
<img src="../../media/img/filler.png" alt="filler" />
</div>
</div>
</div>
CSS
.filler-mask {
position: absolute;
left:0; top:0;
height:361px;
width:559px;
z-index: 900;
}
.filler-img{
position: absolute;
left:0; top:0;
height:361px;
width:559px;
z-index: 50;
}
您可以直接放置图像,而不是使用图像作为背景,但图像不遵循 z-index,因此您必须将图像包装在 div 中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)