CSS:半透明的背景和图像 [英] CSS: Semi-transparent background and an image

查看:154
本文介绍了CSS:半透明的背景和图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

body
{
    background-image: url('cloud.png');
    background-color: rgba(255, 255, 255, 0.6);
}

我试图使用上述以产生半透明白色背景的背景图像的上方。它不工作,只显示背景图片和背景颜色似乎被忽略。

I tried using the above to produce a semi-transparent white background above a background-image. It doesn't work, only the background image is shown and the background-color appears to be ignored.

推荐答案

背景颜色放在下面背景图片,而不是它上面。把一个半透明的白色块状图像上面,您将需要放置在顶部的另一个元素与背景颜色

background-color is placed underneath background-image, not above it. To put a semi-transparent white block above an image, you will need to place another element on top of it with background-color.

这篇关于CSS:半透明的背景和图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆