防止文本在使用opacity属性时变得不透明 [英] Prevent text from getting opaque when using opacity property

查看:666
本文介绍了防止文本在使用opacity属性时变得不透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是使用 opacity 背景的内容,但是这个div中的文字(我的意思是内容div)变得不透明,我看不清楚这个 div 的文本。



我想让容器元素 background 不透明,但不是文字。

  div#content { 
color:white;
width:1150px;
background_color:black;
opacity:.65;
margin:0 auto;
filter:alpha(opacity = 65);
}


解决方案

首先是 background-color 或只是背景,但不包括 background_color / s>,其次,你需要的是 rgba 其中 a 代表 alpha



所以当你想使背景颜色不透明,说黑不透明,比使用

  background-color:rgba(0,0,0,.65); 

演示


I just used opacity for background of content but the text in this div (I mean the content div) gets opaque as well and I cannot see the text of this div clearly.

I want to have the container elements background to be opaque but not the text.

div#content{
    color:white;
    width:1150px;
    background_color:black;
    opacity:.65;
    margin:0 auto;
    filter:alpha(opacity=65);
}

解决方案

First of all it's background-color or simply background but not background_color and secondly, what you need is rgba where a stands for alpha.

So when you want to make the background color opaque, say black opaque, than use

background-color: rgba(0,0,0,.65);

Demo

这篇关于防止文本在使用opacity属性时变得不透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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