Skip to content

background-color: rgba(0,0,0,.5);该属性值最后一个参数,无法设置文字透明! #36

@dingguangbo

Description

@dingguangbo

https://github.com/mdn/css-examples/blob/master/learn/solutions.md#backgrounds-and-borders该文档中要求,使用rgba颜色为半透明的标题添加了背景颜色, background-color: rgba(0,0,0,.5);这个属性值中最后一个参数无法让文字透明(无法让标题透明)。如果让文字在背景中透明,正确的方法应该使用opacity: 0.5;这个属性!

最初学习文档是https://developer.mozilla.org/zh-CN/docs/Learn/CSS/Building_blocks/Backgrounds_and_borders玩转背景和边框中,第3个要求:给h2标题一个半透明的黑色背景颜色,并使文本为白色。但是解决方案中用了background-color: rgba(0,0,0,.5);所以这个不对的。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions