Foundations
Layout
Three widths, Tailwind's breakpoints and one gutter. A page picks the width its content reads at, and nothing on the site measures the device.
Widths and breakpoints
| Class | Value | Used for |
|---|---|---|
| max-w-2xl | 672px | Write-ups: one column of prose |
| max-w-3xl | 768px | Reference pages, galleries, this column |
| max-w-site | 1180px | Landing, project index, the docs frame |
| Class | Value | Used for |
|---|---|---|
| sm: | 640px | One column to two |
| md: | 768px | Stacked hero to side by side |
| lg: | 1024px | Two columns to three; the docs sidebar |
| xl: | 1280px | The docs’ On this page column |
No device sniffing. Layout responds to width; touch-specific behaviour responds to pointer: coarse and hover. There is no isMobile anywhere in any repo running this system.
Helpers
Two classes: the gutter every page sits inside, and the block that takes the site's width from inside a reading column.
site-inset
resize the window: the gutter widens by breakpoint
The content edge.
.aka-breakout gives a block the site width and splits the difference across both margins, which go negative on their own. It is not run here, because this column sits beside a sidebar: a breakout is for the write-up column, where the page is empty on either side. The rule says why it is written the way it is.
@layer components {
.site-inset {
@apply px-5 sm:px-6 md:px-12 lg:px-16;
}
/*
* A block that takes the site's width from inside the reading column.
*
* Give the block the site width, then split the difference between it and
* the column across both margins: the margins go negative on their own,
* stay symmetrical, and `min()` against the viewport shrinks the block into
* the gutter on a narrow window instead of opening a scrollbar, so there is
* no separate mobile rule to keep in sync. 1180px is `max-w-site`, the
* width the project plates take on the landing and on /demo, so a reader
* meets the same grid here rather than a third measure invented for one
* page. Written once here; it used to be an inline style copied into three
* write-ups.
*/
.aka-breakout {
--breakout: min(100vw - 3rem, 1180px);
width: var(--breakout);
margin-inline: calc((100% - var(--breakout)) / 2);
}
}