Design glossaryThe baseline is the invisible line most letters sit on. Descenders drop below it, and aligning text to a shared baseline keeps columns and grids tidy.
In typography, the baseline is the line that letters rest on. Flat-bottomed letters such as n, h, and x sit exactly on it; round letters such as o and e dip a hair below it (an effect called overshoot) so they look level; and descenders in g, p, and y drop clearly beneath it. The x-height, the cap height, and the length of ascenders are all measured up from the baseline.
Not every writing system uses the same line. Latin text sits on an alphabetic baseline, while scripts such as Devanagari hang from a line near the top, and CSS recognizes several baseline types for this reason. For most English-language sites, though, "baseline" means the alphabetic one.
Why it matters in layout
When text in neighboring columns, buttons, or form fields shares a baseline, a page looks orderly even if the font sizes differ. When baselines drift, a layout feels slightly off, even to people who could not say why.
Designers sometimes go further with a baseline grid: a set of evenly spaced horizontal lines, usually matching the body text's line height, that all text and spacing snap to. It creates a steady vertical rhythm, which is especially useful in multi-column editorial layouts. On the web, a strict baseline grid is hard to hold once images, embeds, and user-generated content come in, so most teams settle for a consistent spacing scale and a shared line height instead.
Baselines in CSS
- Inline content.
vertical-align: baselineis the default, so inline images, icons, and text line up on the baseline of the surrounding text. - Flexbox and grid.
align-items: baselinelines up items by the baseline of their first line of text, which is the tidy way to align a large heading with a smaller label beside it. - Line height. The distance from one baseline to the next is set by
line-height, the CSS version of leading.
A common gotcha
Images are inline by default, so they sit on the baseline and leave a small gap underneath for descenders. It is the source of the mysterious few pixels of space below an image inside a card or link. Setting the image to display: block, or giving it vertical-align: middle, removes the gap. WordPress's Image block already removes it with vertical-align: bottom, but the gap still turns up in Custom HTML blocks and older themes.
Source: MDN, vertical-align.