S
PRO
last month
Stephencountry asked

Why does line-height: 1.5; look normal, but line-height: 1.5px; makes the lines super tight? Does adding px really change the meaning?

Abhay Jajodia
Expert
last month
Abhay Jajodia answered

Yes, it changes the meaning a lot. line-height: 1.5; is unitless, so it means 1.5 times the font size, but line-height: 1.5px; forces the line height to be only 1.5 pixels, which is tiny and crushes the text. That’s why lessons usually use the unitless version for readable, scalable spacing.

If you have more questions, I am here to help.

CSS
This question was asked as part of the Learn CSS course.