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!
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
for some reason the font size is still applied to all the elements even if after i add h1 and span tags.
for some reason the font size is still applied to all the elements even if after i add h1 and span tags. Is it because the html inherited the font size?
Gergely Bocz14,244 Points
Can you share your code so that i can see what you did?
My guess is, that you put the h1 and the span tags to the wrong place. For example if you put the h1 tag after the ul, along with the *li list items, then it became their sibling, so they share a common parent, therefore the body still has only 1 "direct child", as the h1 would be a grandchildren of the body, along with the li elements.
So the :only-child selector selects those elements, that don't have a sibling: a node with which our selected element shares a parent. If such a node exists, then they are not selected by the :only-child selector.
Hope it helps! If I didn't answer your question, please share your code so that i can take a look!