Vertical align
noun
say it: “VUR-tih-kul uh-LYNE” /ˈvɝtɪkəl əˈlaɪn/ or “VER-tih-kul uh-LYN” /ˈvɝtɪkəl əˈlaɪn/
The CSS property that lines up an inline or inline-block box with the others in its line, by the text's baseline, their tops, middles or bottoms, or places the content of a table cell.
What does vertical-align do?
vertical-align works on inline boxes and table cells only. On an icon next to text, middle lines it up with the middle of the letters. In a table cell, top, middle and bottom place the cell's content. It doesn't center a box inside its parent: flexbox or grid does that.
.icon { vertical-align: middle; }
td { vertical-align: top; }
In a sentence
- “A small icon sat too low beside its label, so I set its vertical-align to middle.”
- “The cards in the row had ragged tops until I gave each one vertical-align: top.”
Level: Journeyman · More CSS terms at this level
Updated