The Generic Layer: Resets and Normalize
What you'll learn: How to establish a consistent, low-specificity foundation for your styles using browser resets and normalization.
The Foundation of Your CSS Architecture
In ITCSS, the Generic Layer sits at the very bottom of your cascade—right after design tokens and mixins, but before any component-specific styling. This layer's job is to neutralize browser inconsistencies and establish a predictable baseline for all elements.
Think of it like preparing a canvas before painting. Different browsers apply different default styles (margins on headings, padding on lists, etc.). Without a reset or normalize layer, you're building on an uneven surface.
Two Approaches
CSS Resets aggressively strip away all browser defaults, setting everything to zero. Popular examples include Eric Meyer's Reset.
Normalize.css takes a gentler approach, preserving useful defaults while fixing inconsistencies and bugs across browsers.
Why Low Specificity Matters Here
Styles in the Generic Layer use element selectors only—no classes, no IDs:
/* Generic Layer examples */
* {
box-sizing: border-box;
}
body {
margin: 0;
line-height: 1.5;
}
h1, h2, h3, h4, h5, h6 {
font-weight: normal;
}
button {
border: none;
background: none;
}
These have the lowest possible specificity, making them easy to override later in your cascade with component classes. You're not fighting against your own foundation—you're building on stable ground.
Where It Fits
In your stylesheet order:
- Settings (variables)
- Tools (mixins)
- Generic (resets/normalize) ← You are here
- Elements, Components, Utilities (coming next)
Key Takeaway: The Generic Layer uses low-specificity element selectors to reset or normalize browser defaults, creating a consistent, predictable foundation that won't interfere with your component styles later in the cascade.