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 Em Units

Ting Ting Yang
Ting Ting Yang
1,336 Points

In the beginning, Why the relative value's parent is "body"? when we change title size, it based on the size of body?

In the beginning, Why the relative value's parent is "body"? when we change title size, it based on the size of body even though we didn't set the "body"size as default size

thanks ~~~

1 Answer

Steven Parker
Steven Parker
231,248 Points

The element with the class of "title" is a <span> that has the <header> as a direct parent. It is in turn a child of the <body> element. The reference for font size is always based on the direct parent, but in a case of nesting like this, the properties are passed down from level to level.

So while the body isn't the direct parent, changes made to it would affect the "title" span as long as they were not overridden in the immediate parent (the header).

i almost understood lol, do you think you can explain this very very detailed for me?