HTML & CSS · Middle · Question 46 of 75

What is Tailwind's @apply directive for, and why shouldn't you overuse it?

Explanation

.btn { @apply px-4 py-2 rounded; } is handy for styling third-party HTML or base elements. But rewriting a whole project with @apply gives you plain CSS with an extra abstraction layer and a bigger bundle. In Tailwind, reuse is usually solved with (React) components, not classes.

Further reading

Problem with a question

HTML & CSS · Middle · question 46

Test yourself

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

Take this quiz