Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS How to Make a Website Customizing Colors and Fonts Resize Text

Gina Bégin
PLUS
Gina Bégin
Courses Plus Student 8,613 Points

Line-heights, margins, paddings... oh my!

I noticed someone about 4 months ago asked a similar question, and I reviewed this great video from Treehouse that explains margins and paddings (https://teamtreehouse.com/library/css-foundations/the-box-model/the-css-box-model-concept-3) but what I'm wondering is, at :30 in the video, he applies line-height to the h1 tag and says that it is mostly used for spacing of a line in a paragraph, relative to the other lines. I can't see another use for it, since if it's a single word by itself, padding or margin would take care of it, right? If that's the case, then why is it useful to apply to to the h1 tag (am I using the correct semantic there, btw?) when it's not in a paragraph, but a single line by itself?

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Gina;

The line-height property defines the amount of space above and below inline elements. That is, elements that are set to display: inline or display: inline-block. This property is most often used to set the leading for lines of text.

You can read more specifics about the line-height property at the Mozilla Developer's Network.

Ken