Skip to main content
AI/MLhashgraph-online

alignment

Use this skill whenever the design has more than one element on the page — every layout, every form, every table, every page header, every card. Trigger when designing a layout, picking a grid, fixing a UI that "looks off," debating left vs. center alignment for body text, or auditing why a design feels disorderly. Alignment is one of the most foundational principles in ''Universal Principles of Design'' (Lidwell, Holden, Butler 2003) — every visible element''s edge or center should fall on a shared axis with at least one other element. Misalignment by even a few pixels reads as disorder.

Stars
336
Source
hashgraph-online/awesome-codex-plugins
Updated
2026-05-27
Slug
hashgraph-online--awesome-codex-plugins--alignment
View on GitHubRaw SKILL.md

// install — copy + paste into any project

mkdir -p .claude/skills && curl -fsSL https://raw.githubusercontent.com/hashgraph-online/awesome-codex-plugins/HEAD/plugins/HDeibler/universal-design-principles/plugins/perception-and-hierarchy-principles/skills/alignment/SKILL.md -o .claude/skills/alignment.md

Drops the SKILL.md into .claude/skills/alignment.md. Works with Claude Code, Cursor, and any agent that loads SKILL.md files from .claude/skills/.

Alignment

Alignment is the placement of elements so that their edges or centers fall on shared axes — invisible vertical or horizontal lines that thread through the composition. Aligned elements feel ordered, professional, and easy to scan. Misaligned elements — even when the misalignment is small — read as accidental, sloppy, or unfinished. Of all the visual variables a designer manages, alignment is the cheapest to get right and the most expensive to get wrong.

Definition (in our own words)

When elements share an alignment axis, the eye can connect them as part of a system. A row of fields all sharing a left edge reads as a coherent column. A set of buttons all sharing a baseline reads as a related group. A hero headline sharing the page's center axis reads as a deliberate focal moment. When this discipline lapses — when a button is 4px off from its neighbors, when a label hangs out from the rest of the form — the eye registers the discrepancy preattentively. The user may not articulate it, but they sense the design is "off."

Origins and research lineage

  • Gutenberg's printing press (1450s) standardized typesetting, which is fundamentally about strict alignment. Lines of type aligned to baselines; columns aligned to gutters. The discipline predates digital design by centuries.
  • Tschichold and the New Typography (1920s–30s). Jan Tschichold's Die neue Typographie argued for asymmetric, strictly-aligned compositions over the ornamented symmetric layouts of the 19th century. Influential across modernist graphic design.
  • The Swiss style / International Typographic Style (1950s onward). Müller-Brockmann, Hofmann, Gerstner — the canonical formalization of grid-based design. Modernist corporate identity, much of which still defines visual standards, descends from this tradition.
  • Lidwell, Holden & Butler (2003) compactly stated: every element should be aligned with at least one other element. The book's iconic example is the Palm Beach County "butterfly ballot" of the 2000 US presidential election — alignment failures that may have decided the result.
  • Eye-tracking research on grid layouts consistently shows that users scan aligned columnar content faster and more accurately than misaligned layouts.

Why alignment matters

Alignment carries no information by itself — it doesn't tell the user what anything is. What it does is signal that the design was deliberate. A well-aligned composition reads as competent and trustworthy at a perceptual level the user doesn't consciously evaluate. Conversely, misalignment makes everything else feel suspect; if the designer couldn't get the column edges to line up, what else did they miss?

The cost of misalignment compounds:

  • Scanning slows. The eye traces shared axes; broken axes force re-orientation.
  • Trust erodes. Misaligned UIs feel amateur, even on otherwise polished products.
  • Hierarchy fails. Visual hierarchy depends on rhythm; misalignment disrupts the rhythm.
  • Errors accumulate. Famously: Florida's "butterfly ballot" misaligned candidate names with vote-hole positions, almost certainly causing thousands of voters to vote for the wrong candidate.

When to apply

  • Always. This is one of the few principles that applies on every surface, every time, with no exceptions.
  • In particular, on first-pass layouts before pixel-tweaking. Decide the grid; place elements on it; only then refine.
  • In design-system component specs — components must align by default; designers shouldn't have to manually align components from a system that pre-aligned them.

When alignment can be deliberately broken

A small set of cases where intentional misalignment serves a goal:

  • Marketing surfaces wanting "energetic" or "dynamic" feel. Magazines and posters often deliberately misalign to create visual tension. Use sparingly; never in working app surfaces.
  • A single deliberately-emphasized element. Misaligning one element from a grid pulls the eye to it. Effective if used once per surface; noisy if used repeatedly.
  • Decorative or illustrative content. A hero illustration may not align to the body grid; that's fine.

In production app UI, deliberate misalignment is rare. The default is strict alignment; deviation requires justification.

Alignment dimensions

Vertical alignment (left, right, center)

Elements share a vertical axis (a y-axis line). The most common form in UI work.

  • Left alignment (most common in LTR scripts) — text and form fields share their left edge with the column.
  • Right alignment — used for numbers in tables (so digits stack), and for some labels (label-flush-right against input-flush-left).
  • Center alignment — used for hero text, page titles, button labels. Avoid for body text; ragged edges on both sides slow reading.

Horizontal alignment (baseline, top, middle, bottom)

Elements share a horizontal axis (an x-axis line).

  • Baseline alignment — type baselines line up across columns. The eye threads horizontally.
  • Top / center / bottom alignment for icons-with-labels, buttons-with-text, etc. Choose deliberately.

Grid alignment

A grid imposes both vertical and horizontal alignment. Most modern web design uses 12-column grids (responsive: 12 columns for desktop, 6 for tablet, 4 for mobile).

.layout {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.layout > .main { grid-column: span 8; }
.layout > .sidebar { grid-column: span 4; }

Within a grid, every element's edges fall on grid columns (or align to multiples of the column width).

Optical alignment

The mathematically-correct alignment doesn't always look right. Curved or pointed shapes (round buttons, triangular icons) need optical adjustment to look aligned with rectangular ones. Designers shift them by a pixel or two so they read as aligned.

Worked examples

Example 1: a form with strict left alignment

<form style="display: grid; gap: 16px; max-width: 400px;">
  <div class="field">
    <label for="name">Full name</label>
    <input id="name" type="text" />
  </div>
  <div class="field">
    <label for="email">Email</label>
    <input id="email" type="email" />
  </div>
  <div class="field">
    <label for="phone">Phone</label>
    <input id="phone" type="tel" />
  </div>
  <button type="submit">Submit</button>
</form>

<style>
  .field { display: grid; gap: 4px; }
  label, input, button { width: 100%; }
</style>

Every label, every input, the submit button — all share the same left edge and the same width. The eye reads it as a single coherent column. No alignment surprises.

Example 2: a label-input grid with right-aligned labels

A common pattern for dense forms, especially settings pages where the user scans labels:

<form style="display: grid; grid-template-columns: 8rem 1fr; gap: 12px 16px;">
  <label style="text-align: right; padding-top: 0.5rem;">Display name</label>
  <input type="text" />

  <label style="text-align: right; padding-top: 0.5rem;">Email</label>
  <input type="email" />

  <label style="text-align: right; padding-top: 0.5rem;">Phone</label>
  <input type="tel" />
</form>

Two columns: labels on the right, inputs on the left. Labels share a right-edge axis; inputs share a left-edge axis. The space between is the alignment gap. Scanning down either column is effortless.

Example 3: a numeric table

<table>
  <thead>
    <tr>
      <th style="text-align: left;">Customer</th>
      <th style="text-align: right;">Amount</th>
      <th style="text-align: right;">Days late</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Acme Co.</td>
      <td style="text-align: right; font-variant-numeric: tabular-nums;">$2,480.00</td>
      <td style="text-align: right; font-variant-numeric: tabular-nums;">14</td>
    </tr>
    <tr>
      <td>Bright Labs</td>
      <td style="text-align: right; font-variant-numeric: tabular-nums;">$98,001.50</td>
      <td style="text-align: right; font-variant-numeric: tabular-nums;">3</td>
    </tr>
  </tbody>
</table>

Text columns left-align so the eye traces names. Numeric columns right-align with tabular numerals so digit positions stack — the eye can compare magnitudes by counting digits.

Example 4: a header with title and actions

<header style="display: flex; align-items: center; justify-content: space-between;">
  <div>
    <h1 style="font-size: 1.5rem;">Invoices</h1>
    <p style="color: hsl(0 0% 45%); font-size: 0.875rem;">Sent and overdue, this quarter.</p>
  </div>
  <div style="display: flex; gap: 8px;">
    <button>Export</button>
    <button class="primary">New invoice</button>
  </div>
</header>

The header text is left-aligned; the action buttons are right-aligned (against the right edge of the page region). Both groups share the page's vertical center axis. Three alignment axes (left edge, center horizontal, right edge) all working at once.

Example 5: optical alignment for round elements

<button class="rounded-button">
  <svg viewBox="0 0 24 24" width="20" height="20" style="margin-left: -1px;">
    <!-- A play icon (triangle) -->
  </svg>
  Play
</button>

A play triangle is mathematically centered in its viewBox but reads as slightly-too-far-right because the triangle's visual mass is offset. A 1px nudge left brings it into optical alignment. Many design systems handle this in their icon set; otherwise designers do it manually.

Cross-domain examples

The butterfly ballot (2000 US election)

The most famous alignment failure in modern history. Palm Beach County, Florida used a "butterfly" ballot where candidate names were listed on facing pages with punch holes between. The misalignment between candidate text and punch positions was such that voters intending to vote for Al Gore (second candidate listed) frequently punched the second hole — which corresponded to Pat Buchanan, not Gore. Buchanan's vote count in Palm Beach County was statistically anomalous compared to surrounding counties; analysis suggested thousands of misvotes. The election was decided by 537 votes in Florida.

A design failure with material consequence. Lidwell, Holden, and Butler use this case as the canonical alignment example precisely because the stakes were so high.

Newspaper layout

Traditional newspapers use strict columnar grids. Headlines align to columns; body text wraps within column widths; photos crop to align with column edges. The discipline is what lets readers scan a dense front page in seconds.

Tax forms (US 1040)

The IRS 1040 form is a masterclass in alignment. Lines align across columns; figures align to decimal points; signature blocks align across pages. Without this discipline, the form would be unreadable; with it, millions of people complete it (with effort, but they complete it).

Spreadsheets

Cells align to a grid by definition. Spreadsheets succeed as a productivity tool partly because alignment is enforced at the data structure level. Word processors and HTML, by contrast, allow alignment to drift unless designers exercise discipline.

Architecture and urban planning

Manhattan's grid is alignment at city scale. Rome's organic streets are aligned to nothing. Both produce navigable cities, but they navigate differently — the grid is faster to learn; the organic is more interesting to walk.

Anti-patterns

  • Centered body text. Reading speeds drop by 30%+ for centered body text vs. left-aligned. Centered text is for short emphasis (headlines, single sentences), not for paragraphs.
  • Justified text without hyphenation. Justified text (both edges flush) creates "rivers of white" between widely-spaced words. Use ragged-right for screens; if you must justify, enable hyphenation.
  • Mixing alignment within a column. Some labels left-aligned, some right-aligned. Each switch is a re-orientation cost.
  • Invisible micro-misalignments. Elements 2–3px off from their intended position because of inconsistent padding. The page feels "off" even if no one can identify why.
  • Decorative misalignment in working UI. Marketing pages can deliberately misalign for energy; settings pages cannot.
  • Different button sizes in a row. Buttons of varying heights or widths in the same row break the row's baseline.

Heuristics

  1. The squint test. Squint at the page. Edges should fall on shared axes. If columns appear to wobble, you have misalignment.
  2. The grid overlay. Show your grid as a CSS overlay. Every element's edge should fall on a grid line or a half-grid line.
  3. The mass-block sketch. Sketch the page as filled rectangles. The rectangles should share axes — left edges, right edges, baselines.
  4. The mobile + desktop check. Many alignments work on desktop and break on mobile (or vice versa). Audit at multiple breakpoints.
  5. The dynamic content audit. Replace placeholder text with real worst-case content (long names, big numbers, multi-line addresses). Did alignment break?

Related principles

  • good-continuation — alignment exploits good continuation; the eye threads along shared edges.
  • hierarchy — alignment supports hierarchy by establishing the rhythm hierarchy varies against.
  • proximity — proximity establishes grouping; alignment establishes the columns those groups inhabit.
  • uniform-connectedness — aligned items connected by a shared axis read as a system.
  • gutenberg-diagram — when alignment is uniform, the eye falls back to the Z-pattern.
  • aesthetic-usability-effect (aesthetics) — alignment is a major component of "classical" aesthetics; misaligned designs are perceived as less usable even when they work.

Sub-aspect skills

  • alignment-grid-systems — formal grid systems (12-column, modular grids, baseline grids) and how to use them.
  • alignment-text-and-numerics — alignment decisions specific to text (left vs. center vs. justified) and to numeric tables (right-align, tabular numerals).

Closing

Alignment is the cheapest design improvement available — it costs only attention, no new content. Yet it's one of the most-violated principles in production UIs because it's invisible when right and accumulates as drift when ignored. The discipline is in noticing every element's edge and asking: what does this align to? If the answer is "nothing," fix it.