Home >Web Front-end >CSS Tutorial >Is `background-color: none` a valid CSS property?
Validity of background-color:none in CSS
The question arises regarding the validity of the following CSS code:
<code class="css">.class { background-color:none; }</code>
To resolve this, it is necessary to consult the CSS 2.1 specification, which defines the permissible values for the background-color property as:
aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow
Therefore, as none is not included in these lists, it is not a valid value for the background-color property. The intended effect, a transparent background, can be achieved by using the transparent keyword instead.
The above is the detailed content of Is `background-color: none` a valid CSS property?. For more information, please follow other related articles on the PHP Chinese website!