stnd.build

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:

<!-- 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:

<!-- 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>

High-Leverage Flex Helpers


Common Pitfalls & Mistakes

  1. Applying gap without display: flex or grid: CSS silently ignores gap on standard block or inline elements. Always pair gap with .flex or .grid.
  2. Missing Desktop Base on Responsive Columns: Using .sm:col-12 alone leaves desktop width undefined. Always specify desktop first: class="col-4 sm:col-12".
  3. Using .center-horizontally without a bounded width: Auto-margins have no room to distribute on an unbounded block element. Ensure the container specifies max-w-prose, max-w-line, or an explicit width.
  4. 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.