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 CSS Basics (2014) Understanding Values and Units Line Height

Baran Ureten
Baran Ureten
5,749 Points

Why control padding with line-height?

Isn't it easier to just use padding to play around with the space above or below an inline element?

2 Answers

Ivan Franzone
Ivan Franzone
7,328 Points

Simply because "line-height", as its own name indicates, ItΒ΄s more convenient for text elements.

Andreas Anastasiades
Andreas Anastasiades
2,916 Points

True. The line-height makes sure you won't get overlapping text on, let's say, mobile devices...

Padding does not change the space between individual lines of text rhar are part of the same element, it just relates to the space around the element as such. So lin-height gives you control of the space between the lines WITHIN your paragraph/element.