如何在CSS中改变背景颜色的不透明度 [英] How to change the background colour's opacity in CSS

查看:114
本文介绍了如何在CSS中改变背景颜色的不透明度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PNG文件,我给它的透明区域的背景颜色,但我想让背景颜色有点透明,如不透明度。这是我的代码到目前为止:

I have a PNG file which I give a background colour to its transparent areas, but I would like to make the background colour a bit transparent, like opacity. Here is my code so far:

social img{
    opacity:0.5;
}
.social img:hover {
    opacity:1;
    background-color:black;
}


推荐答案

background: rgba(0,0,0,.5);

您可以使用rgba作为透明度,只能在ie9 +和更好的浏览器中使用

you can use rgba for opacity, will only work in ie9+ and better browsers

这篇关于如何在CSS中改变背景颜色的不透明度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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