Open
Description
vertical-align: middle
will align an element with the baseline of text minus half its x-height. This makes it a poor fit for glyph-sized elements like icons, which will always look a tad too low. Ideally we’d have a keyword (vertical-align: text-middle
?) that would align with the middle of the cap height of the typeface instead…
In lieu of this property, I see two dominant techniques for accomplishing this:
- The icon position is adjusted manually, using
top: -1px
or similar. This requires the icon to beinline-block
, since other positioning techniques will conflict with thetop
value. - The icon and text must be wrapped in a container with
display: flex; align-items: center
or similar. But this prevents the icon from being used inline.
(I was encouraged to submit this issue after writing about the idea.)