Skip to content

Understand the mix of rem and unit-less in the new TW line-heights #3386

Answered by simonswiss
sunscreem asked this question in Help
Discussion options

You must be logged in to vote

Hey @sunscreem 👋

For the font sizes from 5xl and up, we want the line height to be the same value as the font size. When you pass a unitless value to the line-height property, it acts as a multiplier of the font size, so line-height: 1 uses the same value as the font size.

We use this to avoid having to explicitly state the font-size value when we always want it to be the same.

We didn't use unitless values for the smaller values, because it would be more complicated to come up with the math to hit a specific target rem value than using the actual rem value 😅

The line-height affects elements height, and you want the element height to be a number that’s in the spacing scale. So we don’t us…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@sunscreem
Comment options

Answer selected by sunscreem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants