Skip to content

Alex Carpenter

Staff UI Engineer at Clerk

Grand Rapids, MI.

<svg viewbox="0 0 16 16" width="32">...</svg>
<svg viewbox="0 0 16 16" height="32">...</svg>

Setting only width or height scales the icon along that axis. Along the other axis, the icon centers itself in whatever space its container gives it via the default preserveAspectRatio=“xMidYMid meet”, instead of stretching to fill it.

Helpful for aligning icons with text with height="1lh".