CSS 3对列表不透明,但不是文本 [英] CSS 3 Opacity for List but not text

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

问题描述


可能重复:

背景不透明,但不是文本

我有一个HTML无序列表。我需要的背景有不透明度为0.3。但我不想这个不透明应用于文本。这里是我当前的CSS;它将文本渲染为不透明度为0.3:

I have a HTML unordered list. I need the background to have an opacity of "0.3". But I don't want this opacity applied to the text. Here is my current CSS; it renders the text as having an opacity of 0.3 as well:

li {
    background-color:pink;
    opacity: 0.3;
}

a {
    color: white;
    opacity: 1.0;
}

如何使链接文字呈现白色?

How do make the link text render white?

推荐答案

你将不得不使用另一种方式来设置你的颜色像rgba这样:

You'll have to use another way to set your color like rgba like this:

li { background-color: rgba(0,0,0,.3); }

您还需要移除opacity属性/值。 BTW,css粉红色的rgb值为:250,192,203,所以:rgba(250,192,203,.3);

You also need to get rid of the opacity property/value. BTW, the rgb values for the css pink color are: 250,192,203, so: rgba(250,192,203,.3);

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

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