Base
Reset, body defaults, typography defaults and shared element rules.
CSS file structure is the difference between a stylesheet you can extend and a stylesheet you are afraid to touch.
css/ settings/tokens.css base/reset.css layout/shell.css components/button.css
Architecture mental model
Small projects can survive one stylesheet for a while. Real projects need a structure that makes future decisions obvious.
File structure is not about making folders because folders look professional. It is about reducing search time, avoiding duplicate rules and giving every type of CSS a predictable home.
The best structure is simple enough to remember and strict enough to prevent random CSS from being thrown anywhere.
Reset, body defaults, typography defaults and shared element rules.
Named values for colors, spacing, typography, radii and motion.
Page shells, grids, regions and structural composition rules.
Buttons, cards, navigation, forms, modals and reusable UI pieces.
Visual model
Design tokens and custom properties live first.
Global element defaults keep the browser predictable.
Page structure and reusable layout primitives belong here.
Reusable interface pieces carry their own states.
Good CSS versus fragile CSS
css/
settings/tokens.css
base/reset.css
base/typography.css
layout/shell.css
components/button.css
components/card.css
utilities/spacing.css
styles.css
/* reset */
/* random button */
/* old homepage */
/* quick fix */
/* another quick fix */
Rules of thumb
Use a small set of folders that match how CSS decisions are made.
Global rules are powerful and should be easy to find.
A card should not know the entire page grid.
Page-specific or temporary CSS should not hide inside reusable components.
button.css is clearer than styles2.css or new.css.
When the same pattern appears three times, it probably deserves a home.
Production thinking
Good file structure lowers the cost of every future change. You spend less time hunting and more time designing.
Accessibility rules such as focus styles, reduced motion and text contrast should be easy to find, not scattered randomly.
A team-friendly structure is boring in the best way: predictable, searchable and hard to misuse.
CSS organization does not directly rank a page, but maintainable CSS helps ship faster, cleaner pages with fewer visual regressions.
Live code lab
The preview runs in an isolated iframe. Links and forms stay inside the practice area, so you can experiment without leaving the lesson.
Mini assignment
Practice assignment
Try it yourself
Self-check
Answer these questions before moving on. If you cannot find, name or move a rule safely, the architecture still needs work.
Senior audit upgrade
A CSS folder structure should make the cascade predictable: tokens, reset, base, layout, components and utilities.
Load broad foundations before specific components.
Use @layer when the architecture benefits from explicit cascade groups.
A file should have a clear responsibility, not a random mix of fixes.