HTML & CSS · Senior · Question 2 of 75
How do normal (non-!important) layered and unlayered styles rank against each other?
- ✓Correct answer: Unlayered styles are stronger than any layer
- 2Unlayered styles are weaker than any layer
- 3Unlayered styles count as a separate layer at their declaration position
Explanation
Unlayered styles implicitly go into a "last" layer and beat all named layers. That lets you wrap third-party CSS in @layer vendor and easily override it with your own styles. With !important the logic flips: important layered styles beat important unlayered ones.