ITCSS Layer Ordering and Import Strategy
You'll learn how to arrange your ITCSS layers in the correct sequence so CSS specificity naturally increases from generic to specific, preventing override conflicts.
Why Order Matters
ITCSS (Inverted Triangle CSS) works because it respects the cascade. Each layer should be more specific than the one before it. Think of building a house: foundation first, walls second, then decorative trim. If you painted the trim before building the walls, you'd have to repaint everything.
Your CSS imports must follow this exact order:
- Settings – Variables only, no output
- Tools – Mixins and functions, no output
- Generic – Browser resets (lowest specificity)
- Elements – Bare HTML tags like
h1,p - Objects – Layout primitives with classes
- Components – Specific UI patterns
- Utilities – Highest specificity overrides
The Import Structure
In your main stylesheet, import layers in order:
@import 'settings/colors.css';
@import 'settings/typography.css';
@import 'tools/mixins.css';
@import 'generic/normalize.css';
@import 'elements/headings.css';
@import 'elements/links.css';
@import 'objects/layout.css';
@import 'components/button.css';
@import 'components/card.css';
@import 'utilities/spacing.css';
Why This Prevents Conflicts
Because each layer is slightly more specific, you rarely need !important. A utility class naturally overrides a component style, which naturally overrides an element style. The cascade does the work for you.
If you import utilities before components, you'll constantly fight specificity battles and resort to hacks.
Key Takeaway: Import ITCSS layers in strict order from least to most specific—Settings, Tools, Generic, Elements, Objects, Components, Utilities—to harness the cascade naturally and avoid specificity wars.