HTML & CSS · Senior · Question 1 of 75
How do @layer cascade layers affect style priority?
- 1Layers are sorted by the specificity of their strongest selector
- ✓Correct answer: Layer order beats specificity: the later layer wins
- 3Layers affect only
!important; normal rules are untouched
Explanation
The cascade compares layers first and only then specificity within a layer. So .btn in the components layer beats #app .btn in an earlier base layer. Unlayered styles are stronger than any layer. For !important the order is reversed: important declarations in an earlier layer win. Tailwind v4 builds its styles on the theme, base, components and utilities layers.