Two layer strategies for Tailwind
Tailwind's utilities are organized with CSS Cascade Layers, which puts priority decisions in your hands. Once you accept that utilities are the framework's core, two arrangements present themselves: Tailwind's recommended order, or one where your own CSS sits above utilities.
The recommended order: utilities last
Tailwind's documented approach places components first and utilities last. If you build components, you wrap them manually in an @layer directive, then treat Tailwind as the most important layer so utilities can overwrite your component styles.
/* Write your components */
@layer components {
.component {
/* Your CSS here */
}
}
<!-- Override with Tailwind utilities -->
<div class="component p-4"> ... </div>
It works well.
The alternative: styles in an unnamed layer
The other option is to author your CSS in an unnamed layer — or in any layer declared after utilities — so your styles naturally override Tailwind utilities. Of the two variants, the unnamed layer is the preferred one.
/* Unnamed layer option */
@layer theme, base, components, utilities;
/* Write your CSS normally here */
.component { /* ... */ }
/* Named layer option */
/* Use whatever layer name you come up with. I simply used css here because it made most sense for explaining things */
@layer theme, base, components, utilities, css;
@layer css {
.component { /* ... */ }
}
Three reasons drive that preference:
- Extra CSS layers add friction: more keystrokes, and the need to remember which layer a given rule lives in.
- With a solid grasp of ITCSS and selector specificity, writing CSS in a single layer is not intimidating.
- Complex work that is difficult or impossible in Tailwind — theming and animations, for instance — remains possible in plain CSS.
The tradeoffs are personal, of course.
What this inverts
- Tailwind utilities are not the most important layer.
- The unnamed CSS layer is the most important layer.
The point of that inversion is a workflow: build prototypes quickly with Tailwind, then move properties into CSS as they grow more complex, so the HTML does not end up dense with utilities. The objection is not that utility HTML is bad — it's that reading it costs a lot of cognitive effort.
!important and what utilities really are
Because Tailwind sits in a utility layer, a utility can always be strengthened with !important.
<!-- !important the padding utility -->
<div class="component !p-4"> ... </div>
This use is legitimate rather than a hack. CSS Layers reverse the meaning of !important: here it declares the Tailwind utility more important than anything in the unnamed layer, a built-in feature of the spec. The keyword is also explicit and rarely needed, which suits one-off adjustments made without writing a new selector.
A related point: Tailwind utilities are not a one-to-one mapping between a class and a CSS property. The built-in utilities mostly look that way, which gives a misleading impression. They behave more like convenient Sass mixins, which means they can serve as the basis for tooling around layouts, theming and typography.



