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 Style the Portfolio

Dorka Tamas
Dorka Tamas
5,085 Points

My navigation links are not centered like my header, why?

...

Samuel Glister
Samuel Glister
12,471 Points

Hey Dorka,

Please can you post your code on here so that the community can take a look at it for you otherwise it makes it a bit difficult for us to help out.

If you need help as to how to post you code click on the 'Markdown Cheatsheet' list below your text box for help.

Thanks.

here is what I have for the same project in my main.css file:

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

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

nav li {
  display: inline-block;
}

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

Maybe you missed a line of code or the dreaded missed semi-colon.

2 Answers

Ashley Gonzalez
Ashley Gonzalez
4,530 Points

try using the margin:0 auto;

inside the nav ul.

Let me know if that works. If it doesn't please put your html on here as well :)

Dorka Tamas
Dorka Tamas
5,085 Points

Thanks! It works now! :)

Ashley Gonzalez
Ashley Gonzalez
4,530 Points

awesome. Glad to hear it