Implement CSS architecture using ITCSS with strictly organized imports: Settings, Tools, Generic, Elements, Objects, Components, Trumps. Explain where a grid system vs a card component vs a utility class belongs in this hierarchy.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Presenting ITCSS CSS architecture with import order and component placement
The answer explains ITCSS layers—Settings, Tools, Generic, Elements, Objects, Components, Trumps—and shows a typical folder structure with SCSS partials. It clarifies that the grid system goes in Objects as a reusable layout pattern, card components in Components as specific UI blocks, and utility classes in Trumps for high-specificity helpers. A main.scss example enforces the strict import order, illustrating proper CSS architecture with sample SCSS imports and brief code snippets.
One of the core ideas behind ITCSS is that you separate concerns into layers and always bring them into your bundle in the same order so that low‑specificity, low‑impact rules sit at the bottom of the cascade and more specific, overriding rules sit at the top.
A typical directory structure in an ITCSS–driven project looks like this:
Your entrypoint main.scss (or styles.scss) then imports each layer in order:
scss
// main.scss
// 1. Settings: global design tokens, no CSS output
@import 'settings/colors';
@import 'settings/typography';
// 2. Tools: functions and mixins, no CSS output
@import 'tools/functions';
@import 'tools/mixins';
// 3. Generic: resets, normalize, box-sizing, etc.
@import 'generic/normalize';
@import 'generic/base';
// 4. Elements: element selectors only, minimal styling
@import 'elements/headings';
@import 'elements/links';
@import 'elements/tables';
// 5. Objects: structural patterns (layout), no cosmetics
@import 'objects/grid';
@import 'objects/media';
// 6. Components: designed UI components (BEM blocks)
@import 'components/card';
@import 'components/button';
@import 'components/navbar';
// 7. Trumps: helpers/utilities that trump everything
@import 'trumps/utilities';
@import 'trumps/helper-spacing';
With that organization:
A grid system is an object: it's a layout pattern composed of classes like .o-grid and .o-grid__item that help you arrange content. It carries little to no visual styling of its own beyond spacing and alignment, and should be reusable across contexts. It belongs under objects/_grid.scss.
A card component is a component: it's a specific piece of UI with presentational styles (borders, shadows, typography) that wraps content in a particular way. It belongs under components/_card.scss.
A utility class is a trump: it's a single‑purpose helper like .u-text-center or .u-mt-sm meant to override previous styles inline. These go at the very top of the cascade in trumps/_utilities.scss so they can “trump” lower layers.
By keeping your partials in these buckets and importing them in the prescribed order, you get a predictable, scalable stylesheet where layout objects don’t accidentally inherit component styles, and utilities have the final say when you need an override.