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

HTML How to Make a Website Styling Web Pages and Navigation Polish the Navigation and Footer

Why is my navigation not centered under my h1 header?

h1 { text-align: center; font-family: 'Changa One', sans-serif; margin: 15px 0; font-size: 1.75em; font-weight: normal; line-height: 0.8em; padding-top: 20px; }

h2 { text-align: center; font-size: 1.0em; margin: -5px 0 0; font-weight: normal; }

/************************************** NAVIGATION ***************************************/

nav { text-align: center; padding: 10px 0; margin: 20px 0 0; }

nave ul { list-style: none; margin: 0 10 px; padding: 0; }

nav li { display: inline-block; }

nav a { font-weight: 800; padding: 15px 10px; font-size: 1.0em; }

nav a { font-family: 'Changa One', sans-serif;}

Chris Davis
Chris Davis
16,280 Points

It looks like you have a spelling & syntax error on your ul selector. Don't add a space between your property value and unit. Hope that helps :thumbsup:

1 Answer

Sarah Giles
Sarah Giles
2,815 Points

text-align: center; might not be what you want to use.

this is meant to be used to align text content inside a textual content item. <nav> is usually a block of content like a <div> that might contain an couple of lists, some links and maybe even an image or two. If you are wanting the whole nav to be centered you will need to use margins. set your left and right margins to 'auto'.