Wait, line-height works like that?!

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

Unitless numbers and percentages for CSS line-height behave differently due to how inheritance works. When using a unitless value like 1.5, the line-height is recalculated on an element-by-element basis relative to each element's own font size. When using a percentage, the line-height is computed once on the parent element and then the resulting pixel value is inherited by all children — meaning smaller or larger text won't get proportionally adjusted line-height. Unitless values are generally the better choice for consistent, scalable typography.

1m watch time
276.6K Impressions6 Comments