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 trialCorey Hayden
11,717 PointsIt seems that adding 'padding: 10px 0;' to nav ul is what centered the nav under the h1 & h2 elements. How so?
When I add declarations one at a time to the 'nav ul' element, the 10px of padding on top and bottom is the declaration that centers it under h1 & h2. why is this?
1 Answer
Marcus Parsons
15,719 PointsHey Corey,
The reason why the nav is centered is because in the "nav" selector, the "text-align" property is set to "center". This is what is centering all text content within the nav element, including the unordered list.
Corey Hayden
11,717 PointsCorey Hayden
11,717 Pointsyes, but even with the nav text-align at center, and the Header (here, '#logo') set to center, the nav is not centered directly under the header until the nav padding is declared...
Marcus Parsons
15,719 PointsMarcus Parsons
15,719 PointsDo you mean horizontally or vertically centered? Also can you post a snapshot of your workspace? If you've never done that, check out this post: http://www.teamtreehouse.com/forum/workspace-snapshots