CSS不透明度属性 [英] CSS Opacity Property

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

问题描述

您好,我使用CSS Opacity属性为div标签,它的工作原理很好,但问题是当我写一些文本或粘贴图像在该div标签,他们也变得褪色。我只需要div的背景颜色是褪色,而不是div的内容。我的代码是...

  #fade div 
{
opacity:0.1;
filter:alpha(opacity = 10); / *对于IE8及更早版本* /
width:750px;
height:150px;
background-color:#FFFFFF;
}

#text in fade div
{
font-weight:bold;
color:#8A2BE2;
}

谢谢!!!



  rgba(0,0,0,.1); 
rgba(0,0,0); // fallback


Hi i am using CSS Opacity Property for a div tag and it works well but the problem is when I write some text or paste images on that div tag they also become fade. I just need div back color to be fade and not the div content. My code is ...

#fade div
{
opacity:0.1;
filter:alpha(opacity=10); /* For IE8 and earlier */
width:750px;
height:150px;
background-color:#FFFFFF;
}

#text in fade div
{
font-weight:bold;
color:#8A2BE2;
}

Thankyou !!!

解决方案

It's much easier to use rgba() or a transparent PNG for the background.

rgba(0, 0, 0, .1);
rgba(0, 0, 0); //fallback

这篇关于CSS不透明度属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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