Sub topic 5
Grids and Shared Edges
This chapter assumes you can use a layout tool such as Figma, Canva, Illustrator, or InDesign. It also assumes you know basic typography terms (typeface, size, weight, line spacing) and common layout elements (headings, body text, images, buttons). The chapter builds on the alignment chapter. Alignment says every element should connect to something else on the page. A grid is the system that makes those connections consistent across a whole layout.
What a grid is
A grid is a set of invisible guide lines that divides a layout into columns, rows, and margins. Elements snap to those lines. A grid does not appear in the final design. It works the way a ruler works while you draw.
A grid has a few parts:
- Margins are the empty borders between the content and the edge of the page or screen.
- Columns are vertical strips that hold content. Most layouts use 2 to 12 columns.
- Gutters are the gaps between columns.
- Rows are horizontal divisions. Print layouts and slides often use them. Web pages often let rows grow with their content.
- Modules are the cells where a row and a column cross.
A shared edge is the practical result. When a heading, a paragraph, an image, and a button all start at the same vertical line, the eye sees one clean line and reads the layout as organized. Without a grid you have to judge each position by eye. Small errors of 3 to 10 pixels pile up, and the page looks careless even if the reader cannot say why.
Why shared edges work
People notice lines even when no line is drawn. If five elements start at the same left position, the eye draws a line through them. That line gives the layout structure, and it gives the reader a path to follow down the page.
Shared edges help in three ways:
- Scanning. A consistent left edge lets the reader jump from one heading to the next without searching.
- Grouping. Elements that share an edge look related. This reinforces proximity.
- Trust. Layouts with consistent edges look professional. Layouts with near misses look accidental.
The phrase near miss matters here. Two elements that are 4 pixels out of line are worse than two elements that are clearly different. The reader sees an error instead of a choice. When you break alignment, break it by a lot.
Common grid types
You can choose from a few standard structures. Pick the one that fits the content.
| Grid type | Structure | Best for | Weakness |
|---|---|---|---|
| Single column | One block of text inside margins | Books, long articles, mobile screens | Wastes space on wide screens |
| Multi-column | Two or more equal columns | Newspapers, magazines, newsletters | Needs consistent column widths to avoid ragged results |
| Modular | Columns and rows forming cells | Dashboards, product listings, posters | Can feel rigid if every module is the same size |
| Hierarchical | Columns of unequal widths | Websites with a main area and a sidebar | Needs a clear reason for each width |
A 12-column grid is common on the web because 12 divides evenly by 2, 3, 4, and 6. You can build halves, thirds, quarters, and sixths from the same grid. A 4-column grid is common on phones, because there is less width to divide.
Building a grid in CSS
CSS Grid lets you write a grid directly. This example is a two-column page. The first column is narrow, and the second is twice as wide.
.page {
display: grid;
grid-template-columns: 1fr 2fr;
column-gap: 24px;
align-items: start;
}
.page > * {
text-align: left;
}The 1fr 2fr value makes the second column twice as wide as the first. The fr unit means a fraction of the free space. The column-gap value sets the gutter at 24px. The align-items: start line pins each item to the top of its cell, so tall and short items start on the same horizontal line. The text-align: left rule gives every child a shared left edge inside its column.
Each direct child of .page now sits in a column. Items in the first column share one left edge. Items in the second column share another. Together they form two strong vertical lines.
Here is a complete page that uses the grid. You can save it as an .html file and open it in a browser.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Grid demo</title>
<style>
body { margin: 0; padding: 32px; font-family: system-ui, sans-serif; }
.page {
display: grid;
grid-template-columns: 1fr 2fr;
column-gap: 24px;
row-gap: 16px;
align-items: start;
}
.page > * { text-align: left; margin: 0; }
h1 { grid-column: 1 / -1; }
.label { font-weight: 700; }
</style>
</head>
<body>
<div class="page">
<h1>Workshop schedule</h1>
<p class="label">Morning</p>
<p>Registration opens at 9:00. Coffee is served in the lobby.</p>
<p class="label">Afternoon</p>
<p>Sessions start at 1:00 and finish at 4:30.</p>
</div>
</body>
</html>The heading uses grid-column: 1 / -1, which makes it span from the first grid line to the last. Its left edge matches the left edge of the labels. The body text in the second column forms a second shared edge. The reader sees two clean lines and a heading that ties them together.
Choosing column width and gutters
Column choices change how the page reads. Three points cover most cases.
Line length. Body text reads best at about 45 to 75 characters per line. A line that is too long makes the eye lose its place when it returns to the next line. A line that is too short breaks the rhythm of reading. In CSS you can limit width with the ch unit, as in max-width: 65ch. A grid column that holds body text should respect this range.
Gutter size. The gutter must be wide enough to separate columns, but narrow enough that the columns still look like one layout. If the gutter is too small, text in neighboring columns runs together. If it is too large, the columns look unrelated. A gutter between 16px and 32px suits most screens. Using the same value as one of your spacing steps keeps it consistent with the rest of the layout.
Margins. Margins frame the content. Make them at least as wide as the gutter. Many designers make the outer margin larger than the gutter so the content has room.
Aligning text: left edges and ragged edges
Text alignment decides which edge is shared.
- Left-aligned text gives a strong shared left edge and a ragged right edge. It is the best default for Latin-script body text, because each line starts in a predictable place.
- Right-aligned text gives a strong right edge. Use it for short items, such as numbers in a table or a caption next to an image on its left.
- Centered text has no shared edge. Every line starts at a different place. It works for a short title, a quote, or an invitation. It is hard to read in more than two or three lines.
- Justified text gives both edges, but it can create uneven gaps between words, called rivers. It needs hyphenation and wide columns to look good.
A frequent mistake is to center everything because centered layouts feel safe. A page with a centered heading, centered paragraph, and centered button has three different left edges, so the eye finds no line to follow. Choose one alignment for related content and keep it.
Breaking the grid on purpose
A grid is a tool, not a rule. Designers often break it to draw attention. A large image might bleed past the margin to the edge of the page. A pull quote might step into the gutter.
A break works only when the rest of the layout is strict. The break looks like a decision because the reader can see the pattern it departs from. If most elements are already loosely placed, nothing stands out. This links to contrast: a grid creates a baseline of order, and a deliberate violation becomes a high-contrast moment.
Use these checks before you break a grid:
- Is there one clear reason, such as emphasis or drama?
- Is the break large enough that nobody will read it as a mistake?
- Does the rest of the layout still follow the grid?
If you answer no to any of them, move the element back to the grid.
Common grid problems
| Symptom | Likely cause | Fix |
|---|---|---|
| Elements look almost aligned | Positions set by eye or by dragging | Turn on snapping and guides, or use a layout system such as auto layout or CSS Grid |
| Text lines are very long | One wide column on a large screen | Add columns or set a `max-width` in `ch` |
| Columns feel disconnected | Gutter is too large | Reduce the gutter to a spacing step |
| Columns run together | Gutter is too small | Increase the gutter, at least 16px on screens |
| The layout looks rigid and dull | Every module is the same size | Let some elements span two or more columns |
| Page looks messy on mobile | Desktop grid copied unchanged | Define a separate, narrower grid for small screens |
Grids in common tools
Each tool you may be using has a built-in way to set up a grid.
- Figma offers layout grids on a frame. You set the number of columns, the gutter, and the margin, and elements snap to them.
- Canva provides rulers and guides, and you can drag guides from the edge of the canvas.
- Illustrator and InDesign support guides, and InDesign sets columns and margins when you create a document.
- CSS uses
display: gridordisplay: flexwith a consistent gap value.
Whatever the tool, set up the grid before you place content. Adjusting a grid after the fact means moving everything.
Check your understanding
Exercise
A flyer has a left-aligned heading, a centered paragraph, and a button that sits 6px to the right of the paragraph's left edge. Name two problems with the shared edges and give one fix for each.
Show answer
First, the heading is left-aligned and the paragraph is centered, so the two have no shared edge and the eye has no line to follow. Fix this by left-aligning the paragraph so it shares the heading's left edge. Second, the button is a near miss, 6px off the paragraph's edge, which reads as an error. Fix this by snapping the button to the same left edge, using a guide or a grid column.
Exercise
In the CSS example with grid-template-columns: 1fr 2fr, the page is 960px wide with no padding and a 24px column gap. How wide is each column?
Show answer
The free space is 960 - 24 = 936px. Dividing it into three parts gives 312px per part. The first column is 312px (1fr) and the second is 624px (2fr).
Exercise
A designer breaks the grid by letting one photo run to the edge of the page. List two conditions that make this look intentional instead of accidental.
Show answer
The rest of the layout must follow the grid strictly, so the reader can see the pattern the photo departs from. The break must also be large and clear, such as a full bleed to the page edge, so that it does not look like a 5px mistake.