Is background-color:none valid CSS?

前端 未结 7 2433
独厮守ぢ
独厮守ぢ 2020-11-28 19:04

Can anyone tell me if the following CSS is valid?

.class {
    background-color:none;
}
7条回答
  •  南笙
    南笙 (楼主)
    2020-11-28 19:54

    You probably want transparent as none is not a valid background-color value.

    The CSS 2.1 spec states the following for the background-color property:

    Value: | transparent | inherit

    can be either a keyword or a numerical representation of a colour. Valid color keywords are:

    aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow

    transparent and inherit are valid keywords in their own right, but none is not.

提交回复
热议问题