How to write CSS properties
CSS properties can be written in many ways, including:
Abbreviations
background-color
can be abbreviated to bgcolor
can be abbreviated to
font
Case
CSS property names are not case-sensitive, but the convention is to use lowercase.Connectors and CamelCase
Using prefixes
Some CSS properties have prefixes to indicate that they belong to a specific browser or version. Prefix for WebKit browsers
Prefix for Mozilla browsers
Using Variables
You can use CSS variables to store and reuse property values.<code class="css">:root { --primary-color: red; } body { color: var(--primary-color); }</code>
Priority
Different CSS property writing methods have different priorities:) Highest priority
The above is the detailed content of There are several ways to write css attributes. For more information, please follow other related articles on the PHP Chinese website!