我有一个带有透明 png 作为其背景图像的元素 - 它就像一张宝丽来照片被切掉了,所以只显示了框架。
以此为背景,然后我想要一个标准图像位于具有透明 png 背景的元素后面 - 以适应框架。
我已经尝试设置 z-indexing 和不透明度,尽管由于不透明度设置,我可以让图像通过其明显透明的方式显示。
有什么想法吗?
最佳答案
如果 .yourPhoto 是背景图片,您可以这样做:
<div class="yourPhoto">
<div class="yourPNGframeImage">
</div>
<div>
或者您可以使用内联图像并使用绝对位置:
<div class="container">
<img class="yourPhoto" src="">
<img class="yourPNGframeImage src="">
</div>
.container {position: relative;}
.yourPhoto, .yourPNGframeImage {position: absolute; top: 0px; left: 0px;}
关于css - 透明PNG作为背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1704717/