I saw people using line height without specifying a unit, like this: line-height: 1.5;
What does the number represents? I'm guessing it's a ratio so is it like em
?
line-height
@ Mozilla Developer Network has a very good explanation (and examples) which is a easier to understand compared to the line-height
CSS specification.
line-height
can have the value specified in one of the following ways
line-height: normal | <number> | <length> | <percentage>
In your case, you are using a <number>
which is described as:
The used value is this unitless
<number>
multiplied by the element's font size. The computed value is the same as the specified<number>
. In most cases this is the preferred way to set line-height with no unexpected results in case of inheritance.