You might need to know about the CSS lh unit
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
The CSS `lh` unit equals the computed value of the `line-height` property and enables several practical layout techniques. Use cases covered include: setting paragraph margins proportional to line height, creating paper-line background effects that stay aligned when font size changes, rounding floated image heights to the nearest text line using `calc-size()` and `round()`, limiting list height to an exact number of lines with a matching fade mask, and sizing button icons relative to text. The unit solves problems that previously required pixel hacks or were difficult to maintain across font size changes.
Table of contents
IntroductionVertical spacingPaper line effectFloating images alignmentFaded contentButton iconFurther reading1.3K Impressions1 Comment