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 How to Make a Website Styling Web Pages and Navigation Build Navigation with Unordered Lists

Paul O'Connor
PLUS
Paul O'Connor
Courses Plus Student 2,510 Points

Nav element is not centering on page

I'm 2/3 of the way through the front end web track and really enjoying it. I've noticed that my web page is not displaying like Nick's version. The nav links are set to the left when they should be centre page. My CSS for nav is this:

/***************************** NAVIGATION ******************************/ nav { text-align: centre; padding 10px 0; margin: 20px 0 0; }

Should not the text-align be enough to centre the links?

Richmond Lauman
Richmond Lauman
28,793 Points

Without seeing all your html and css I have to guess a little here but here goes...

The text-align: centre will cause children of the nav element to be centered but will not centre the nav element itself. Try giving the nave element a width of 100% or changing the margin to margin: 20px auto; .

2 Answers

Try spelling "centre" as center. That might help.

Paul O'Connor
PLUS
Paul O'Connor
Courses Plus Student 2,510 Points

I just worked out what the problem was, it was a typo

'text-align: centre' should be text-align: center'.

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