1. Stackability. If there is a style conflict, follow the CSS writing order and the final style shall prevail.
2. Inheritance, the child tag will inherit some styles of the parent tag.
Such as font size, text color and other text attributes.
3. Priority. When two or more rules are applied to an element at the same time, the weight needs to be considered.
Example
<style> /* The weight of ul and li 0,0,0,1 + 0,0,0,1 = 0,0,0,2 */ ulli { color: green; } /* The weight of li is 0,0,0,1 */ li { color: blue; } /* The weight of .nav and li 0,0,1,0 + 0,0,0,1 = 0,0,1,1 */ .nav li { color: pink; } </style> <body> <ul> <li>I am green</li> </ul> </body>
The above are the three major features in CSS. I hope it will be helpful to everyone.