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 trialcodeoverload
24,260 PointsWhy is the em value inherited within the selector itself?
I am a little bit confused right now...
I thought 1 em is equal to the parent/container's font size, so when you use 1 em inside of the child element inherits the value from his parent element.
But why would it make sense if 1 em is always equivalent to the last font-size you used inside of the same selector.
Example code:
h2 {
font-size: 3.3125em; /* 53px/16px */
font-weight: normal;
line-height: 1.1;
margin-bottom: .5em; /* 26px */
}
Is there an example which demonstrates when this inheritance inside of a selector itself would be helpful?
Thank you very much, treehouse community is awesome!
1 Answer
Kevin Korte
28,149 PointsI think this article will address your question, which is a good one by the way: http://www.teachingmultimedia.com/mmp240/HowMuchIsThatEm.html
codeoverload
24,260 Pointscodeoverload
24,260 PointsOkay, this makes a lot more sense now.
Thanks for your answer!
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsNo problem, I had to go look it up myself lmao!