Line height – Webflow CSS tutorial (using the Old UI)


Setting the line height of text-based content
is really important, if for no other reason than to prevent those who are looking at your content from being greeted with an
illegible dumpster fire. Two main types of line heights we’re going
to cover: number…and fixed. Number — what’s essentially a unitless number
is usually the preferred way to go. It’s essentially a multiplier. That is: if your font size is 30 pixels and
you set this to 1 (you can choose unitless by selecting it from the dropdown), the line
height is 30 pixels. 30 pixel font size, line height of 1, that’s
a 30-pixel line height. Set it to 1.2, now it’s 36 pixels. And because of this multiplying property,
you don’t have to change the line height when you change the font size. Because it’s dependent on the font size, it
scales automatically. Now, if you’ve designed and developed using
percentages before, there are actually inheritance issues that can crop up. There’s tons of documentation on this, but
the short version is: unitless numbers are usually preferred over percentages. The second type of line height is fixed. The most common representation here is in pixels. This is actually the default and it works
great, as well. You can simply type in a value, and the line
height is updated. Now for pixels, or unitless numbers, you can
of course use the up and down arrows on the keyboard to adjust, and you can hold shift while
doing the same thing to make more rapid changes. In addition to pixels, if you’re keeping track
of inheritance, you can use ems — or you can even use rems in this field. Just like font size, sometimes the best way
to get comfortable with line heights and these units is to directly visualize the result
on the Canvas. And that’s…line height.

2 Comments

Add a Comment

Your email address will not be published. Required fields are marked *