--- name: alignment description: '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.' --- # 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). ```css .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 ```html
``` 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: ```html ``` 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 ```html| Customer | Amount | Days late |
|---|---|---|
| Acme Co. | $2,480.00 | 14 |
| Bright Labs | $98,001.50 | 3 |
Sent and overdue, this quarter.