Home >Web Front-end >CSS Tutorial >Is \'background-color:none\' a Valid CSS Declaration?
Is 'background-color:none' a Legitimate CSS Declaration?
In CSS, the 'background-color' property is employed to set the background color of an element. However, there has been some debate as to whether 'background-color:none' constitutes a valid declaration.
Answer:
No, 'background-color:none' is not a valid CSS declaration.
The CSS specifications define the permitted values for the 'background-color' property:
Value: <color> | transparent | inherit
Where:
However, 'none' is not listed among the valid values. Therefore, it cannot be used to declare a background color.
Instead, if you desire a transparent background, use 'background-color:transparent'. This value effectively renders the background of an element invisible without modifying other visual properties.
The above is the detailed content of Is \'background-color:none\' a Valid CSS Declaration?. For more information, please follow other related articles on the PHP Chinese website!