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 trialShaun Glassman
6,496 PointsQuestions about inheritance
So in this example, when we take the main-nav class, which is part of the ul element, we have to specify that the li elements would be inline block and we can't just say that the .main-nav class is inline block and expect that the li elements inherit the inlineblock.
However, when we add text-align: center; to the .main-header, the list items inherit the text-align: center; property.
Why would the center alignment get inherited in this instance, when inline block doesn't get inherited?
2 Answers
Lindsay Sauer
12,029 PointsHi Shaun,
This is because the User Agent Stylesheet has default settings specifically set for li elements, which makes that styling have more specificity than if you were to just use the class .main-nav.
To see an explanation of specificity, this is a good resource, and this one describes it in Star Wars terms.
ywang04
6,762 PointsThe same question has been discussed before.
In a nut shell, the display property is not inherited in CSS.