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 trialKireeti K
9,675 PointsHow is the line-height determined in relative to the font-size?
In the below code how is the line-height determined in relative to the font-size
p{ font-size: 1.2em; line-height: 1.7; /* Line Height is Unitless */ }
Also if i declare the below rule
praragraph{
font-size: 1.5em; /* Paragraph is the ID of p element above */ }
In this case as ID holds the more weight 1.5em should replace the 1.2em declared above i guess and in this case how the calculation is done to increase the line-height accordingly?
Thanks for your valuable time in advance
2 Answers
Steven Parker
231,248 PointsYou are correct that the line-height should increase with the font-size.
But it looks like you misspelled "praragraph" (paragraph).
cameroneckelberry2
8,701 PointsFrom the Mozilla Docs:
"<number> 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."
So, when you increase the font size by .3em as in your example the line height will increase .3em as well.
There are a few more ways to use line height here if you are interested: Mozilla Docs