HTML & CSS · Middle · Question 46 of 75
What is Tailwind's @apply directive for, and why shouldn't you overuse it?
- 1It loads Tailwind plugins; without it utilities in markup don't work
- 2It applies utilities only in production builds and ignores them in dev
- ✓Correct answer: It inlines utilities into your own class; overuse grows the CSS and defeats the approach
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.