[英]How do I add an image over background colour?
How do I add an image over background colour?如何在背景颜色上添加图像? I want the image the to at the bottom of the div.
我希望图像位于 div 的底部。 I tried it with the code below but it doesn't seem to work for me.
我用下面的代码尝试了它,但它似乎对我不起作用。 See code below:
请参见下面的代码:
.teal { text-align: center; padding: 40px; background-color: #2dd5c4; background-image: url("https://www.w3schools.com/html/pic_trulli.jpg"); background-repeat: no-repeat; background-position: bottom; }
<div class="teal"> <h3>Lorem ipsum dolor sit amet</h3> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo l. igula eget dolor. Aenean massa. <br /> <button> Call to action</button></p> </div>
Maybe try add the !important tag at the end of the background-image也许尝试在背景图像的末尾添加 !important 标签
background-image: url(https://www.w3schools.com/html/pic_trulli.jpg) !important;
u can use this:你可以使用这个:
background-image: url()背景图像:url()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.