3 Things (Almost) No One Knows About CSS

Hmm I suppose you could do something like:

* { line-height: 1.2em; }

This would cause every element in your document to calculate its own line height based on its own font size. But you can get the same effect with just

html { line-height: 1.2; }

and that only requires the browser to match one element, rather than every single element on the page.

To be clear, this:

html { line-height: 1.2em; }

will not calculate auto-adjust the line height for each element’s font-size. It calculates a fixed line height (1.2 times the html element’s font-size) and every element in the document inherits that fixed height, regardless of its own font-size.

3 Likes