Welcome to the Treehouse Community
Looking to learn something new?
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,567 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.