new course
CSS grid landing page tutorial (36min)

Lesson info

Lesson info

Line height is the ver­ti­cal space be­tween lines of text, which is called "leading" in print design. You can use different units for line height to make it scale automatically with the font size, or be independent of the font size.

In this video, we’ll cover:

  1. ‍Editing line height
  2. ‍Using relative units
  3. ‍Using fixed units

Explore this project

Want to dig into the project featured in this video and see how everything is put together? We've included the full project we used when making this lesson, and we've shared the link right under this very paragraph.

View and clone this projectDownload lesson assets
Clone this projectDownload project assets


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.