html - 有什么办法可以使 css 中文本的背景不透明吗?

标签 html css opacity

<分区>

有没有办法在 css 中仅使文本的背景颜色不透明?(不是文本颜色...只是文本的背景颜色)...我不想使用图像背景。

这是一个例子:

enter link description here

背景是不透明的,但文本也是不透明的......我不想要它......

最佳答案

当然,使用 rgba():

div ul li a.title {
    padding: 0px 12px 0 0px;
    background:rgba(255,0,0,.2);
}

jsFiddle example

关于html - 有什么办法可以使 css 中文本的背景不透明吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22209509/

相关文章:

CSS opacity 只给背景色,不给文字吗?

ios - 向 UITextField 添加不透明 subview

html - CSS:为什么不透明度只适用于子元素而不适用于父元素?

html - CSS 下拉菜单似乎落后

html - 嵌套表格内的弹出框落后于外表

javascript - 两个浏览器窗口之间的通信 : popup and parent

html - 如何不让辅助功能专注于复选框

html - 如何在 twitter-bootstrap 网格表中隐藏太长的文本?

html - CSS - 连接两个类

html - page-break-after 不产生页面