图像和文字与不透明背景在同一个DIV [英] Image and text with opacity background in the same DIV
本文介绍了图像和文字与不透明背景在同一个DIV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图用不透明的方式制作图片和文字!
I'm trying to make an image and text with an opacity!
背景出现在相同的div中,而不使用图片作为背景。我如何使这项工作?
Background appear in the same div without using the image as background. How can I make this work?
请参阅图片:
推荐答案
<div>
<span>Title</span>
<img src="" />
</div>
div{
position: relative;
}
span{
background: rgba(0,0,0,0.5);
position: absolute;
bottom: 0;
left: 0;
padding: 6px;
display: block;
}
这篇关于图像和文字与不透明背景在同一个DIV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文