Overview
PimentCSS layout is intentionally small: a centered container, a flex-based 12-column grid, spacing utilities mapped to --space-* tokens, and a handful of display helpers. Import via the full bundle or pimentcss-design-system/core when you only need tokens + layout.
| Layer | Location | Purpose |
|---|---|---|
| Spacing tokens | tokens/layout.css | --space-1 … --space-7, radii, borders |
| Container & grid | scss/layout/ | .container, .row, .col-* |
| Utilities | scss/utilities/ | Spacing, display/flex, shadows |
| Copy width | .copy-block | Max width 33rem for comfortable line length |
Prerequisites
- PimentCSS installed, Installation (layout ships with the default CSS).
- Semantic colors, surfaces and text from Colors for readable UI inside columns.
- Typography, heading/body utilities from Typography inside grid regions.
Spacing & layout tokens
Canonical spacing lives in tokens/layout.css. Override Sass variables before @use "pimentcss-design-system", see Customization.
:root {
--space-1: 0.25rem; /* 4px */
--space-3: 1rem; /* 16px */
--space-4: 1.5rem; /* 24px, default grid gutter */
--space-6: 3rem; /* 48px */
}
/* Sass (optional) */
$container-max-width: 75rem;
$grid-gutter: $space-4;
$copy-block-max-width: 33rem;
Container
.container centers content, applies horizontal padding ($grid-gutter), and caps width at 75rem. Use .container--fluid for full-bleed sections while keeping gutter padding.
<main class="container">
<h1 class="heading-h1">Dashboard</h1>
<p class="body-medium">Content stays centered on wide screens.</p>
</main>
12-column grid
Rows use flexbox with wrap. Columns are width fractions of 12 (.col-1 … .col-12). Gutters come from horizontal padding on columns (half gutter each side).
<div class="container">
<div class="row">
<div class="col-8">
<section aria-labelledby="main-title">…</section>
</div>
<div class="col-4">
<aside aria-label="Related links">…</aside>
</div>
</div>
</div>
Responsive columns
From 48rem (min-width), .col-md-* classes apply. Below the breakpoint, stack with .col-12 so mobile users get a single column without horizontal scroll.
<div class="row">
<div class="col-12 col-md-4">Column A</div>
<div class="col-12 col-md-4">Column B</div>
<div class="col-12 col-md-4">Column C</div>
</div>
Spacing utilities
Margin, padding, and gap helpers map to the spacing scale (0–6). Prefer gap-* in flex/grid layouts instead of chaining margins.
Visual scale only, class names follow the token number (.mt-3, .mb-4, .p-3, .gap-4).
| Class pattern | Maps to |
|---|---|
.m-0 … .m-6 | margin (all sides) |
.mt-* · .mb-* | margin top / bottom |
.p-0 … .p-6 | padding (all sides) |
.gap-0 … .gap-6 | flex/grid gap |
<div class="d-flex gap-3 align-center"><button type="button" class="btn btn--outline">Cancel</button><button type="button" class="btn btn--primary">Save</button></div>
Display & flex helpers
Utility classes for common flex layouts and visibility. Combine with spacing utilities; avoid inline styles in production when a utility exists.
| Class | Effect |
|---|---|
.d-flex · .d-inline-flex | Flex formatting context |
.d-block · .d-none | Block / hide (d-none removes from layout, use for panels, not icons alone) |
.flex-column | Vertical stack |
.align-center · .justify-between | Align / distribute on cross/main axis |
.text-center | Center text (not a substitute for page headings hierarchy) |
Readable line length
Long prose should stay within 33rem (~66 characters). Use the .copy-block component or max-width: 33rem in your own styles.
Release notes
The copy block limits line length for comfortable reading in both light and dark themes.
Page shell pattern
Typical app shell: container → header row → main + aside. Use real landmarks (<header>, <main>, <aside>) so screen readers follow the same order as the visual grid.
Antilles Hub
Shipments
Container + grid keep reading order logical: header, then main column, then aside.
Quick integration
-
Wrap the page
Place primary content in.container. Addcontainer--fluidonly for hero bands or full-width data tables.<main class="container">…</main> -
Split columns
Use.rowand column classes. On small screens, start with.col-12and add.col-md-*for tablet/desktop.<div class="row"> <div class="col-12 col-md-8">…</div> <div class="col-12 col-md-4">…</div> </div> -
Space components
Prefergap-*inside toolbars and card footers. Use semantic text colors inside each column.<div class="d-flex gap-3 align-center"><button class="btn btn--primary">OK</button></div>
Class reference
| Class | Description |
|---|---|
.container | Centered max-width shell + horizontal padding |
.container--fluid | Full width with gutter padding |
.row | Flex row with negative gutter margin |
.col-1 … .col-12 | Column width (12-column fraction) |
.col-md-1 … .col-md-12 | Column width from 48rem viewport |
.m-* · .mt-* · .mb-* | Margin utilities (0–6) |
.p-* · .gap-* | Padding and flex gap utilities |
.d-flex · .flex-column · … | Display / flex / alignment helpers |
.copy-block | Constrained prose width (33rem) |
.shadow-xs … .shadow-xl | Elevation shadows, see Depth & shadows |
Sass customization
@use "pimentcss-design-system/core" with (
$container-max-width: 72rem,
$grid-gutter: 1.25rem,
$space-5: 2.5rem,
$copy-block-max-width: 36rem,
);
Accessibility
Layout & RGAA
- Reading order, DOM order must match visual order; do not rearrange columns only with CSS
orderwithout testing with a screen reader. - Reflow, stack columns on small viewports (
.col-12); avoid horizontal scroll for text (WCAG 1.4.10). - Contrast, text inside columns uses
--text-bodyon--surface-page/--surface-elevated(validated on Colors). - Touch targets, keep actions in grid cells at least 44×44px (
--min-touch-target), see Buttons. - Zoom, spacing uses
rem; layout must remain usable at 200% zoom.