CSS <baseline-position> Data Type
The <baseline-position> data type is the keyword baseline, first baseline or last baseline, which aligns items by their text baselines.
Description
The <baseline-position> CSS data type represents the keywords used to align items by their text baselines rather than by their box edges. It is accepted by the box alignment properties, including align-items, align-self, align-content, justify-items and justify-self, as well as the place-items and place-self shorthands.
Baseline alignment is useful when neighbouring items contain text of different sizes. Aligning them to the top or centre makes the text look uneven, whereas aligning their baselines makes the text sit on one shared line, the way words of different sizes sit on the same line in a sentence. The keyword baseline on its own is the same as first baseline, which uses the baseline of the first line of text in each item. last baseline uses the baseline of the last line of text instead, which is handy for aligning the bottoms of cards or form rows with multi-line content.
Items that take part in baseline alignment form a baseline-sharing group. If an item has no text to produce a baseline, the browser synthesizes one from the item's box edges. When baseline alignment cannot be applied, the value falls back to start (for first baseline) or end (for last baseline).
Examples:
/* Price and label sit on the same text line */
.price-row {
display: flex;
align-items: baseline;
gap: 8px;
}
/* Align multi-line cards by the last line of text */
.cards {
display: grid;
grid-template-columns: repeat(3, 1fr);
align-items: last baseline;
}
/* One item opting into baseline alignment */
.badge {
align-self: first baseline;
}
The <baseline-position> type works alongside the other alignment types, such as <content-position> and <self-position>, and can be useful in typographic layouts such as headings with icons, navigation bars and pricing tables.
Interactive Demo
Syntax
<baseline-position> = [ first | last ]? && baseline
Values
- baselineAligns the item using its first baseline. This is the same as first baseline.
- first baselineAligns the first baseline of the item with the first baseline of the other items in its baseline-sharing group. The fallback alignment is start.
- last baselineAligns the last baseline of the item with the last baseline of the other items in its baseline-sharing group. The fallback alignment is end.
Example
Browser Support
The following information will show you the current browser support for the CSS baseline-position data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
Desktop





Tablets & Mobile





