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
Sidney François2,092 Points
Why/how is the _base.scss line-height calculated?
I have a rather unspectacular question.
_base.scss we set
margins using the em function. So far so good.
But I don't understand for what reason the
line-height is calculated by dividing
42px. I have watched that part of the video several times but I just don't see (the probably obvious) reason for it?
Wayne Priestley19,579 Points
Calculating line hight and anything else to do with typography can get extremely complicated if you choose to go down that rabbit hole, using golden ratio etc. Spend a little time googling the math behind it all and you'll soon see.
But to answer your question, you can generally use 1.1 as a way to calculate line height, so the 46 / 1.1 = 41.818181 etc, rounded up to 42.
And vice versa 46 / 42 = 1.0952 rounded up to 1.1
So I'm presuming the 42 was a pixel size for a h1 and you get a line height of 46 or 1.1em.
Now I think I have that correct, but I tend to go on what looks better to me.