Framework Cheat Sheet
Syntax grammar, layout invariants, keyboard shortcuts, and rules of thumb for writing Standard markup.
This page is an operational summary of Standard’s syntax grammar, layout invariants, and rules of thumb.
Exhaustive Token Reference: For the complete list of utility tokens and live stylesheet specimens, search via ⌘K or browse the Live CSS Stylesheets. For copy-paste UI building blocks, see Vanilla-First UI Patterns.
Keyboard Shortcuts
[ (hold) # Workshop: inspect page without local changes
] # Workshop: toggle drawer (open, pin, close)
Shift + Cmd/Ctrl + D # Toggle debug mode (baseline grid & rhythm overlay)
ESC # Close active drawer or modal
The Naming Grammar
Standard utilities adhere strictly to the [property]-[scale] convention across all modules.
Scale values follow one of two interchangeable, mathematically bound systems:
- T-shirt Scale:
3xs · 2xs · xs · sm · base · lg · xl · 2xl · 3xl · 4xl · 5xl · 6xl - Rhythm Units (1rlh multiples): No suffix = 1 baseline unit (e.g.,
.mt), numbers2through12for multiples, plushalf(0.5rlh) andtrim(0.25rlh) for fractions. - Universal Boundary Tokens:
0,auto,full. - Responsive Modifier: The
sm:prefix specifies the mobile breakpoint (≤768px) override (e.g.,.p-xl.sm:p-base).
<!-- Valid variants adhering to the same grammar -->
<div class="mt-lg">T-shirt scale</div>
<div class="mt-2">Rhythmic multiple (2 baseline units)</div>
<div class="mt-half">Rhythmic fraction (0.5 baseline unit)</div>
<div class="p-xl sm:p-base">Responsive padding</div>
Core Layout Invariants
1. Spacing: Gap on the Parent, Never Margin on Children
Always apply gap, gap-x, or gap-y to the flex or grid container. Applying margins to child elements creates asymmetric boundary spacing that breaks container boundaries.
<!-- Correct: Container manages distribution -->
<div class="flex gap-2">
<button>Action A</button>
<button>Action B</button>
</div>
<!-- Anti-pattern: Child margins fight container edges -->
<div class="flex">
<button class="mr-2">Action A</button>
<button>Action B</button>
</div>
2. Centering: The Three Mechanics
There is no bare .center class. Standard separates box centering from text alignment:
<!-- 1. Flexbox / Grid content centering (both axes) -->
<div class="center-content">
<p>Centered vertically and horizontally</p>
</div>
<!-- 2. Block centering (distributes margin-inline auto on a bounded element) -->
<article class="max-w-prose center-horizontally">
<p>Centered column (requires max-w-*, w-*, or intrinsic width)</p>
</article>
<!-- 3. Text alignment (optical text flow, does not affect the bounding box) -->
<h1 class="text-center">Centered Heading</h1>
3. Widths & Reading Measures
Standard enforces optical line lengths based on human reading comfort:
max-w-prose/max-w-line: Caps container to reading measure (--prose-width, ~42rem / 65–75 characters).max-w-page: Caps container to global layout bounds (--page-max-width, 1400px default).- Breakpoints:
max-w-mobile(≤768px),max-w-small(≤1024px),max-w-large(≤1280px),max-w-wide(≤1440px).
<!-- Reading-width article centered on page -->
<article class="max-w-prose mx-auto">
<p>Optimal reading line length maintained across viewports.</p>
</article>
Prose Layout Mechanics
In Standard, .prose has no fixed width or alignment of its own; it inherits both from its parent context.
Centered vs Flush-Left
By default, .prose sits inside body, which centers itself with margin-inline: auto. To make an article flush-left with the container boundary, apply the .left modifier:
<main class="prose left">
<h1>Title</h1>
<p>Zeroes margin-inline and drops the grid's mirrored gutters.</p>
</main>
Width Tokens
Two independent tokens govern dimensional bounds (override in YAML frontmatter or layout CSS):
| Token | Scope | Configured via |
|---|---|---|
--page-max-width |
Outer shell ceiling for .prose, .hero, and .full |
Note frontmatter or :root { --page-max-width: 1400px } |
--prose-width |
Body copy and heading column inside .prose (~42rem) |
Note frontmatter or :root { --prose-width: 40rem } |
---
title: Custom Width Document
page-max-width: 1200px
prose-width: 38rem
---
Swiss 12-Column Grid
The grid container (.grid) divides horizontal space into 12 proportional tracks:
<div class="grid gap-2">
<main class="col-8 sm:col-12">Primary Content (2/3)</main>
<aside class="col-4 sm:col-12">Sidebar (1/3)</aside>
</div>
- Classic Swiss Ratios:
col-6+col-6: Equal halves (50% / 50%)col-8+col-4: Asymmetric content and sidebar (66% / 33%)col-4× 3 : Symmetrical three-column gallery (33% each)col-3× 4 : Four-column metric or feature grid (25% each)
- Responsive Stacking: Always declare the desktop span first alongside the
.sm:col-12mobile override (.col-4.sm:col-12).
High-Leverage Flex Helpers
.flex-far: Instant shorthand forflex items-center justify-between. Perfect for toolbars, headers, cards, and modal footers..flex-col: Switch flex direction to vertical flow..flex-1: Allow item to greedily expand and fill available track space.
Common Pitfalls & Mistakes
- Applying
gapwithoutdisplay: flexorgrid: CSS silently ignoresgapon standard block or inline elements. Always pairgapwith.flexor.grid. - Missing Desktop Base on Responsive Columns: Using
.sm:col-12alone leaves desktop width undefined. Always specify desktop first:class="col-4 sm:col-12". - Using
.center-horizontallywithout a bounded width: Auto-margins have no room to distribute on an unbounded block element. Ensure the container specifiesmax-w-prose,max-w-line, or an explicit width. - Hardcoding inline styles (
style="margin: 0 auto"): Use Standard’s self-documenting semantic classes (.center-horizontally,.mx-auto,.max-w-prose) to preserve theme adaptability.