Sub topic 4
Alignment: Give Every Element a Visual Connection
This chapter assumes you can use a layout tool such as Figma, Canva, Illustrator, or InDesign. It also assumes you know basic type terms (typeface, size, weight, line spacing) and common layout parts (headings, body text, images, buttons). The CSS examples are short and need only a basic reading of HTML and CSS.
What alignment means
Alignment is the practice of placing every element so that it shares an edge or a center line with at least one other element. Nothing sits where it does by accident. The reader may never notice the shared edge, but they feel its effect as order.
Robin Williams states the rule in The Non-Designer's Design Book: nothing should be placed on the page arbitrarily. Every item should have a visual connection with something else on the page. That connection does not have to be physical contact. An invisible line that runs down the left side of a heading, a paragraph, and an image is enough.
Alignment answers a different question from proximity. Proximity decides which items belong together. Alignment decides how the items, and the groups, are tied into one composition. A layout can have well-grouped content and still look messy, because the groups start at slightly different positions.
Why it works
The eye looks for lines. When several elements share a left edge, the eye reads that edge as one strong vertical line and treats the elements as a set. When each element starts at a different position, the eye finds many weak edges and has to re-orient at every one. This costs effort, and the page reads as unplanned.
Alignment also supports visual hierarchy. A strong shared edge gives the reader a path. In a left-aligned column, the eye can run down the edge, find each heading, and decide what to read.
The four kinds of text alignment
| Alignment | Edge or axis | Works well for | Watch out for |
|---|---|---|---|
| Left | Straight left edge, ragged right | Body text, forms, most web content in left-to-right languages | A very uneven right edge on narrow columns |
| Right | Straight right edge, ragged left | Numbers in tables, short captions beside a left-hand image | Long passages are hard to read because each line starts in a new place |
| Center | Shared center axis, both edges ragged | Short, formal pieces such as invitations, titles, and certificates | Multiple lines of centered body text, and mixing centered items with left-aligned ones |
| Justified | Straight left and right edges | Newspaper-style columns with hyphenation turned on | Uneven word gaps and "rivers" of white space in narrow columns |
Left alignment is the default choice for body text. Each line begins at the same place, so the eye finds the next line without effort. Use another alignment when you have a reason.
One dominant alignment
The most common alignment mistake is mixing alignments within one layout. A left-aligned heading above a centered paragraph above a right-aligned caption gives you three edges that compete. None of them is dominant, so none organizes the page.
Pick one main alignment and apply it to the whole layout. Then add exceptions deliberately. For example, a page may be left-aligned throughout, with right-aligned numbers in one table column. The exception has a job, so the page still looks consistent.
Centered layouts deserve special care. A centered axis is easy to set up, but it is weaker than a hard edge, because the ragged edges on both sides give the eye nothing to follow. Centered design is formal and calm. It suits a wedding invitation. It suits a settings page much less.
Edges, centers, and near-misses
Elements can be connected in three ways:
- Edge alignment: the left, right, top, or bottom edges line up.
- Center alignment: the centers of the elements share an axis.
- Baseline alignment: the text baselines line up across columns or beside an icon.
Alignment either happens or it doesn't. A near-miss is worse than a clear difference. If two blocks are 2px apart, the viewer sees an error. If they are 40px apart, the viewer sees an intentional offset. The same applies to angles and sizes.
Near-misses usually come from these sources:
- Dragging by hand without snapping.
- Text boxes with internal padding, so the text edge is not the box edge.
- Different frames that hold the same kind of content but have different padding.
- Copying and pasting between files with different settings.
Select the elements and use the align tools in your application instead of nudging by eye. Figma, Illustrator, and InDesign all have align and distribute commands. Canva and Figma show smart guides, the pink or red lines that appear when an edge matches another element.
Optical alignment
Mathematical alignment and perceived alignment are sometimes different. Some cases:
- Round and pointed shapes. A circle or a triangle that sits exactly on a shared edge looks as though it is set back, because it touches the edge at only one point. Let round shapes overshoot the edge slightly.
- Large type. Large letters carry some blank space at their sides. A 72px heading can look indented compared with 16px body text even when both start at the same x position. Nudge the heading left by a few pixels if it looks indented.
- Quotation marks and bullets. If a paragraph starts with a quotation mark, the text line looks indented. Hanging punctuation, where the mark sits outside the text edge, makes the letters line up. InDesign has optical margin alignment for this.
- Icons and text. Align an icon to the text's x-height or cap height, not to the outer edge of the line box.
Trust your eyes after the numbers are right. Then change the numbers only where the eye disagrees.
Alignment in code
The next chapter covers grids in detail. For now, the point is that CSS can express shared edges directly. The example below puts two columns on a grid and left-aligns the content of each.
.page {
display: grid;
grid-template-columns: 1fr 2fr;
column-gap: 24px;
align-items: start;
}
.page > * {
text-align: left;
}Here is a complete page that uses it. Save it as page.html and open it in a browser.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Alignment demo</title>
<style>
body { font-family: system-ui, sans-serif; margin: 32px; }
.page {
display: grid;
grid-template-columns: 1fr 2fr;
column-gap: 24px;
align-items: start;
}
.page > * { text-align: left; }
h2, p { margin: 0 0 8px; }
</style>
</head>
<body>
<div class="page">
<div>
<h2>Schedule</h2>
<p>Saturday, 10:00</p>
</div>
<div>
<h2>About the workshop</h2>
<p>Both columns start at the same top edge, and the text in each column starts at the same left edge.</p>
</div>
</div>
</body>
</html>Three properties do the work:
align-items: startaligns the tops of the grid items. Without it, the default isstretch, which resizes boxes but can leave short text floating at different heights if the items use other layout settings.text-align: leftkeeps every line of text on the same left edge inside its column.grid-template-columnsfixes where each column starts, so the left edge of the second column is the same for every row.
Right-aligned numbers are the standard case where an exception is correct. Digits stack cleanly when the right edge is shared and the digits have equal widths:
.price {
text-align: right;
font-variant-numeric: tabular-nums;
}tabular-nums makes every digit the same width, so a 1 sits directly above a 9 and the columns of digits line up. Not every font supports it. Check this in the font you use.
Common alignment errors
Use the list below when you review a layout.
- Mixed alignments. A heading is left-aligned and the paragraph under it is centered. Choose one, usually left.
- Centered everything. The layout has no strong edge. Move body text to a left edge and keep centering only for short, formal elements.
- Floating elements. An image or button is placed by eye and shares no edge. Snap it to a column edge or to the text edge.
- Near-misses. Two edges differ by a few pixels. Align them exactly.
- Padding mismatch. A text box has padding, so its text starts further in than the text beside it. Align the text, not the box.
- Narrow justified text. Wide word gaps show up in a short line. Switch to left alignment or widen the column.
- Multi-line centered text. A paragraph of five lines is centered. Each line starts in a new place, so the eye has to search. Left-align it or shorten it.
- Misaligned baselines. Labels and values in neighboring columns sit on different baselines. Align them to a common baseline.
Edge cases
- Right-to-left languages. In Arabic or Hebrew, the dominant edge is the right. In CSS, prefer
text-align: startandendoverleftandright, so the layout flips with the text direction. - Ragged edges. The ragged side of left-aligned text should look natural. Avoid very short lines or very long words that leave big gaps. Manual line breaks can fix a headline, but do not use them in body text that will reflow.
- Responsive layouts. A layout that is aligned at 1200px wide can lose its edges at 400px. Check the narrow version and confirm that elements still share edges after they stack.
- Mixed content. Images have no text edge. Align the image's outer edge to the text edge, not the image's content, unless the image has a visible frame.
- Overlap. Elements that overlap on purpose still need an alignment. Align the overlapping element to a line that other elements also use.
Alignment and the other principles
Alignment depends on proximity. Items you group closely should also share an edge, and the whitespace around the group should be consistent. It also supports repetition: when headings, images, and captions repeat the same alignment from page to page, the reader learns where to look. It works with contrast too. A heading in a larger, heavier face works best when the heading sits on the same left edge as the text below it, so the size difference is the only thing that sets it apart.
Practice
Exercise
A flyer has a left-aligned title, a centered paragraph, and a right-aligned phone number. All three are placed by eye. Which problem does this layout have, and what is the smallest change that fixes it?
Show answer
It mixes three alignments, so no edge dominates and each element looks arbitrary. The smallest fix is to pick one dominant alignment, usually left, and apply it to all three elements, snapping them to the same left edge. Keep an exception only if it has a clear purpose.
Exercise
Two cards in a layout have text that starts 3px apart horizontally. A reviewer says "it looks like a mistake." Should you leave the difference, increase it, or remove it? Explain.
Show answer
Remove it. A small offset reads as an error, while a large offset reads as a decision. Since the cards should share an edge, set both text starts to the same x position, using the application's align tool or the same padding value in CSS.
Exercise
In CSS, why is text-align: right plus font-variant-numeric: tabular-nums a good choice for a column of prices?
Show answer
Right alignment gives every price a shared right edge, and tabular numerals give every digit the same width. Together, the digits stack in clean columns, so the reader can compare values at a glance.