Sub topic 9
Grids and Alignment as Balance Tools
This chapter assumes you know what visual weight is, where the central axis and optical center sit, and how symmetrical and asymmetrical balance differ. It also assumes you can read basic CSS. Here you will see how grids and alignment give balance a structure, and how to use them without making a layout rigid.
Why balance needs a structure
Visual weight tells you how heavy an element feels. A grid tells you where elements are allowed to sit. Without a grid, you place each element by eye, and small errors add up. Two blocks that look balanced at one size drift apart when the page is resized or the content changes.
A grid is a set of invisible lines that divides a page into columns, rows and margins. Elements snap to those lines. Because the lines repeat, the eye reads the spaces between elements as consistent, and consistency makes a layout feel calm and stable.
A grid does not create balance by itself. It limits where weight can go, so you can reason about balance in units (columns) instead of pixels.
Anatomy of a grid
Most layout grids are built from the same few parts.
| Part | What it is | Effect on balance |
|---|---|---|
| Column | A vertical band that holds content | Sets the units in which you measure weight |
| Gutter | The space between two columns | Keeps neighboring elements from merging into one heavy mass |
| Margin | The space between the grid and the page edge | Frames the composition and sets its outer limits |
| Row or baseline | A horizontal line that text or shapes sit on | Keeps weight level across columns |
| Module | The block where a row and a column cross | Gives a repeatable cell for images and text |
The number of columns changes how you can balance. An even count, such as 4 or 12, has a center line between two columns. That suits symmetrical layouts. An odd count, such as 3 or 5, has a middle column that sits on the axis. That suits a centered element with matching sides.
A 12-column grid is common because 12 divides into 2, 3, 4 and 6. You can split it into halves for symmetry, or into 8 and 4 for an asymmetrical layout, and still use the same lines.
Alignment: the second tool
Alignment means placing edges or centers on a shared line. There are four common kinds.
- Left alignment puts left edges on one line. The line becomes a strong vertical, and it carries weight on its own.
- Right alignment does the same on the right edge. It is useful for balancing a left-heavy layout.
- Center alignment puts the centers of elements on the axis. It produces symmetrical balance.
- Baseline alignment puts the bottoms of text lines on one horizontal line, even when the text sizes differ.
A shared edge acts like a visual wire. The eye follows it and groups the aligned elements together. This is why a strong alignment line can balance a lot of weight. A thin column of text with a clear left edge can hold its own against a large photograph on the other side of the page.
Alignment lines carry weight
An alignment line is not neutral. A hard, repeated edge draws attention. If many elements share the left edge and nothing shares the right edge, the layout leans left. You can correct that by creating a second line on the right, even if only one or two elements sit on it.
Symmetry on a grid
A symmetrical layout needs the grid itself to be symmetrical. That means equal margins on the left and right, and an axis that falls on a column or between two columns.
The following CSS builds a centered, symmetrical header. The two side columns are equal and flexible, so the middle column stays on the axis whatever its width.
.header {
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: center;
gap: 1rem;
padding: 0 2rem;
}
.header .left { justify-self: start; }
.header .logo { justify-self: center; }
.header .right { justify-self: end; }Here the logo stays centered even when the left item is wide and the right item is narrow. A simpler layout using flexbox, such as justify-content: space-between with three items, would place the middle item by the leftover space. When the outer items have different widths, the middle item moves off the axis. That is a common balance bug.
Asymmetry on a grid
An asymmetrical layout uses unequal columns, and the grid lets you pick the ratio on purpose. A common choice is 2 to 1, or 8 to 4 on a 12-column grid.
Balance comes from trading weight against distance and contrast. A wide, pale block takes two columns. A small, dark block takes one. The dark block is heavier per unit of area, so the two sides feel level.
.page {
display: grid;
grid-template-columns: repeat(12, 1fr);
column-gap: 1.5rem;
max-width: 72rem;
margin: 0 auto;
}
.page .feature {
grid-column: 1 / span 8;
background: #e8eef2;
min-height: 18rem;
}
.page .aside {
grid-column: 9 / span 4;
background: #1b2a35;
color: #fff;
align-self: start;
min-height: 8rem;
}Both blocks snap to the same 12 column lines. The feature block starts at line 1 and the aside starts at line 9. The shared top edge and the shared gutter hold the layout together, even though the sizes differ.
Choosing the ratio
Ratios that are close to equal, such as 7 to 5, tend to look like a failed attempt at symmetry. The eye expects them to match and notices that they do not. Clearer ratios, such as 2 to 1 or 3 to 1, read as intentional. Pick a ratio that is clearly different.
The optical center and the grid
The optical center sits slightly above the geometric center of a page. A grid is built from geometry, so it does not account for this. If you place an element on the exact middle row, it often looks too low.
You can correct it in two ways.
- Use unequal margins. A larger bottom margin than top margin moves the visual middle up.
- Nudge the element a small amount above its grid position, then check it by eye.
Treat the grid as a default, and let your eye make small adjustments where the geometry misleads you.
Optical alignment
Mathematically exact alignment does not always look aligned. Shapes have different visual edges.
- A circle or a triangle aligned to a left edge looks indented, because only one point touches the line. Push it slightly past the line so it looks flush.
- Large quotation marks at the start of a paragraph leave a gap in the text edge. Hanging them into the margin keeps the edge straight.
- Text in a light weight beside a heavy block can look weaker than its box size suggests.
Designers call this optical alignment. It breaks the grid by a few pixels, and it makes the result look more correct.
.quote {
text-indent: -0.45em; /* hang the opening quotation mark into the margin */
}
.badge-circle {
margin-left: -0.15rem; /* overshoot so the curve looks flush with the edge */
}The offsets are small and depend on the font and the shape, so check them visually.
Spacing rhythm and balance
A grid also controls the vertical rhythm. If gaps between sections follow a scale, such as multiples of 8 pixels, the spaces feel related to each other. Related spaces make weight distribution easier to read.
Uneven gaps carry a message. A larger gap says that two groups are separate. A smaller gap says they belong together. Gaps that are only slightly different look like mistakes.
Negative space interacts with the grid in the same way. Empty columns count as weight in the layout. A left-heavy page with two empty columns on the right can look balanced when the empty area is large and clean, and unbalanced when it looks like missing content. Keep the empty area deliberate by aligning other elements, such as a small caption or a rule, to its edge.
Working from structure to detail
The following diagram shows a practical order for balancing a layout with a grid.
Start with the heaviest element, because it sets the lean of the whole composition. Then add counterweights, align them, and test. If the test shows a lean, return to the counterweights before you touch the details.
Common errors
- Too many alignment lines. If every element has its own left edge, the page looks scattered, and no balance is readable. Reduce the layout to a few shared lines.
- Grid without judgment. An element can be exactly on the grid and still look wrong. Check by eye, and adjust optically.
- Centering by flexbox leftovers. As shown above,
space-betweendoes not keep the middle item on the axis when the outer items differ in width. Use a1fr auto 1frgrid. - Near-equal columns. Ratios like 7 to 5 look accidental. Use a clear difference.
- Equal margins on all sides. This makes content look like it is sinking, because of the optical center. Give the bottom a little more room.
- Ignoring responsive changes. A balanced two-column desktop layout stacks into one column on a phone, and the weight shifts from side-to-side to top-to-bottom. Check that the heaviest element still leads when stacked.
Breaking the grid on purpose
An element that crosses a gutter, bleeds off the page edge, or sits off the grid stands out because everything else follows the lines. This is a way to create emphasis or tension, which a later chapter covers in detail. The rule is to break the grid once or twice, and make the break clearly intentional. If many elements break the grid, the grid stops being readable, and the break loses its effect.
Exercises
Exercise
A header uses display: flex; justify-content: space-between with a wide menu on the left, a small logo in the middle and a narrow button on the right. The logo looks off-center. Why does this happen, and what CSS fixes it?
Show answer
With space-between, the free space is divided equally between the items, so the logo sits halfway between the edges of its neighbors, not at the center of the page. Because the menu is wider than the button, the logo shifts toward the button. Use a grid with grid-template-columns: 1fr auto 1fr and set justify-self to start, center and end on the three items. The equal 1fr columns keep the logo on the axis.
Exercise
On a 12-column grid, you place a pale photo across columns 1 to 7 and a dark text block across columns 8 to 12. The layout feels slightly off. Suggest a change to the column split, and explain your choice.
Show answer
A 7 to 5 split is close to equal, so the eye expects it to match and sees a small mismatch. Change to a clearer ratio, such as 8 to 4 (photo on columns 1 to 8, text on columns 9 to 12), or 6 to 6 for a symmetrical layout. With 8 to 4, the dark, high-contrast text block adds weight per unit of area, which balances the larger pale photo.
Exercise
You center a circular icon exactly on the left margin line, and it looks indented compared with the square image below it. What is this effect called, and how do you correct it?
Show answer
It is an optical alignment problem. A circle touches the line at one point, so it looks smaller and further in than a square that touches along a full edge. Move the circle slightly past the line, for example with a small negative margin, until it looks flush with the square. Check the result by eye.