HTML & CSS · Senior · Question 1 of 75

How do @layer cascade layers affect style priority?

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.

Further reading

Problem with a question

HTML & CSS · Senior · question 1

Test yourself

Take the HTML & CSS · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz