CSS Academy · Lesson

File Organization: ITCSS and 7-1 Pattern

Structure CSS files using the Inverted Triangle or 7-1 pattern for scalable projects.

Lesson 3 of 413 steps

File Organization: ITCSS and 7-1 Pattern is a free CSS Academy lesson on CoddyKit. This is lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the CSS Academy learning path, and your progress syncs across the web and the CoddyKit app. The CSS Academy course includes 4 lessons in total.

Why Organize CSS Files?

As projects grow, a single CSS file becomes unmanageable. File organization structures help teams split CSS into logical layers that are loaded in the right order and easy to navigate.

ITCSS: Inverted Triangle CSS

ITCSS organizes CSS into layers ordered by increasing specificity. Like an inverted triangle, the widest (most generic) rules are at the top; the most specific at the bottom. This respects the natural cascade.

ITCSS Layers

The 7 layers of ITCSS (most to least generic):

  1. Settings — Variables and design tokens
  2. Tools — Mixins and functions
  3. Generic — Reset/normalize
  4. Elements — Base HTML element styles
  5. Objects — Layout abstractions (no cosmetics)
  6. Components — UI components
  7. Utilities — Overrides, helpers, !important allowed here

ITCSS File Structure

A typical ITCSS file layout:

  <pre class="file-tree">src/styles/
  01-settings/
    _colors.scss
    _typography.scss
    _spacing.scss
  02-tools/
    _mixins.scss
  03-generic/
    _reset.scss
  04-elements/
    _headings.scss
    _links.scss
  05-objects/
    _container.scss
    _media.scss
  06-components/
    _button.scss
    _card.scss
  07-utilities/
    _text-align.scss
    _display.scss</pre>

7-1 Pattern

The 7-1 pattern organizes Sass into 7 folders and 1 main file that imports everything:

  • abstracts/ — variables, functions, mixins
  • base/ — reset, typography, base elements
  • components/ — buttons, cards, modals
  • layout/ — header, footer, sidebar, grid
  • pages/ — page-specific styles
  • themes/ — multiple themes
  • vendors/ — third-party CSS

Main Entry File

A main main.scss imports all partials in order:

  <pre class="file-tree">@use 'abstracts/variables';
@use 'abstracts/mixins';
@use 'base/reset';
@use 'base/typography';
@use 'components/button';
@use 'components/card';
@use 'layout/header';</pre>

CSS Layers (@layer) for Organization

Modern CSS @layer provides the same cascade-ordering benefits as ITCSS without a preprocessor. Layers are declared once and their priority is fixed regardless of source order.

  <div class="card text-primary">Layered card text</div>

Colocation vs Centralized

An alternative to centralized style files: colocate component CSS next to the component file. Common in React/Vue projects using CSS Modules or CSS-in-JS.

Naming Sass Partials

Sass partial files start with an underscore (_button.scss). The underscore signals to Sass that the file is not compiled independently — it must be imported into a main file.

PostCSS as an Alternative

If you are not using Sass, PostCSS with the @import plugin or native CSS @import with @layer achieves the same file organization without a preprocessor.

Component CSS Files

Whether using ITCSS, 7-1, or colocated files, each component should have its own file. Name the file after the component it styles: _card.scss, button.css, Nav.module.css.

Quick Check

In ITCSS, which layer sits at the very top of the inverted triangle (widest/least specific)?

Recap

ITCSS orders CSS layers from generic to specific following the cascade. The 7-1 pattern organizes Sass into 7 folders imported through one main file. Modern CSS @layer provides the same cascade control natively. Whether centralized or colocated, the key principle is: one file per component, consistently ordered imports.

Free to start

Learn CSS with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
40
Lessons
159

Frequently Asked Questions

Is the “File Organization: ITCSS and 7-1 Pattern” lesson free?

Yes — the full text of “File Organization: ITCSS and 7-1 Pattern” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the CSS Academy course, upgrade to CoddyKit PRO. The CSS Academy course includes 4 lessons in total.

What will I learn in “File Organization: ITCSS and 7-1 Pattern”?

Structure CSS files using the Inverted Triangle or 7-1 pattern for scalable projects. You practise CSS Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start CSS Academy?

No prior experience is required. CSS Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 3 of 4.

How long does the “File Organization: ITCSS and 7-1 Pattern” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this CSS Academy lesson?

Yes. Every CSS Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Why CSS Architecture Matters
  2. BEM: Block Element Modifier Naming
  3. File Organization: ITCSS and 7-1 Pattern
  4. Avoiding Specificity Wars
← Back to CSS Academy