layoutbeginner

Alignment

The positioning of elements along a shared edge or axis to create visual order and connection.

Plain English

Alignment is the invisible grid that makes a layout feel intentional. When elements share a left edge, a top edge, or a centre axis, the eye perceives them as related. When elements are randomly positioned — slightly off from each other, seemingly by accident — the layout feels amateur. The discipline of alignment is about being deliberate: every element aligns with something else, and that alignment communicates structure.

Technical

Implemented through Flexbox (justify-content, align-items), CSS Grid (grid placement), text-align, margin: auto (horizontal centering), and absolute positioning with consistent offsets. The most important rule: left-aligned content is the most readable default. Centre alignment works for short, isolated elements (headings, hero copy, empty states). Mixed alignment in one component (some left, some centred) without reason looks like a bug.

Live Demo

Alignment

❌ Misaligned

Card Title
Some description text here

✓ Aligned

Card Title

Some description text here

Alignment creates order. Misalignment creates visual noise.

Usage

✓ Good usage

Left-align all card content (image, title, description, CTA) so the grid feels ordered and the eye knows exactly where to go on each card.

✗ Bad usage

A card with a left-aligned title, centred description, and right-aligned button — three different alignments in one small component create confusion.

Common mistakes

AI Prompt Example

Copy this into Claude, Cursor, Bolt, or v0.

Left-align all card content. Centre the hero headline and CTA. Right-align all numbers in tables. Every element aligns with at least one other element — nothing floats at a unique position.