Layout
Alignment
Alignment is placing elements against shared horizontal and vertical axes so a layout looks orderly and guides the eye.
Definition
Alignment is the act of placing elements against two invisible guides: a horizontal axis (left, center, right) and a vertical axis (top, middle, bottom). It sounds almost too simple, but when the many elements on a screen all line up along the same unseen line, people read that as "clean" and "finished." When elements drift slightly out of line, viewers can rarely put their finger on why, yet they sense something unsettled and unpolished. That is what makes alignment the most invisible skill that quietly decides how finished your work looks. The core idea is simple: instead of putting every element on its own line, get as many of them as possible to share the same one.
Why does it matter?
Our eyes naturally travel along a straight edge. When text, images, and buttons share a common guide, the gaze flows without interruption and you can scan the content quickly. When alignment breaks down, the eye has to hunt for a new starting point on every element, stumbling a little each time — and that small fatigue adds up until the whole screen feels hard to read. Alignment also reveals the relationships between elements. Items placed on the same line signal that they are equal or belong together, while an element set deliberately off the line reads as emphasis or an exception. In other words, mastering alignment means designing both the flow of attention and the relationships between elements at once — and together with spacing, it forms one of the two pillars of visual order. In practice, when a screen looks messy, checking your guides before you touch colors or fonts is often the move with the least effort and the biggest payoff. Pulling one stray element back onto the shared line can visibly tidy the impression of the entire screen.
Common mistakes
- Centering everything out of habit. Center alignment is powerful for short headings, buttons, or empty-state messages where you want to draw the eye, but on multi-line body text it forces every line to start at a different point, which actually makes reading harder.
- Giving each element its own guide. When one card sits flush left and another is nudged slightly inward, the eye picks up on the tiny mismatch and the screen feels untidy.
- Left-aligning numbers or prices. Figures with different digit counts should be right-aligned so the place values line up vertically, letting you compare magnitudes at a glance.
Practical tips
- Keep the number of shared guides as small as you can. Just getting most elements to share a single left edge is often enough to make a screen look instantly composed.
- Remember the default: left-align long text, center short and standalone elements. When you break the rule, you should be able to explain to yourself why this one thing is different.
- Alignment and spacing move together. Once elements sit on the same line, tidying the gaps between them to a consistent scale gets you a long way toward a professional-looking screen with very little effort.
Ask your AI
In the code/design I'm pasting below, find every alignment I've set through text-align and margin/padding, and pull the mismatched starting points onto one shared left edge. Aim to minimize the number of guides the whole screen shares, and if any element is deliberately off the line, add a one-line note on why that one gets its own guide. Don't touch colors or fonts — fix alignment only — then give me a table of what changed and the reasoning.
In the code I'm pasting below, re-set the text-align values based on the type of content. Switch any body text or paragraph that runs two or more lines to left alignment (text-align: left) so every line starts at the same point, and only allow center alignment for short, standalone elements like headings, buttons, or empty-state messages. For anything you keep centered, add a one-line reason why it needs to pull the eye, and show the changes as before/after.
In the table/pricing code I'm pasting below, right-align every column that holds numbers or money (text-align: right). The goal is that figures with different digit counts still line up place value by place value vertically, so magnitudes are comparable at a glance. Keep label (header) text left-aligned, but match each numeric-column header to its column's right alignment, and if you can, apply tabular-nums (font-variant-numeric) to the figures so their widths stay even too.