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 Create a Horizontal List of Links

Error states top margin not set but margin tag is set to 0.

Error: Be sure to set the top margin to 0.

nav a { margin: 0; padding: 10px; color: #fff; }

I also tried setting the margin tag to 'margin: 0 0;' but that didn't work either. What am I missing?

Thanks Susan

css/main.css
a {
  text-decoration: none;
}

#wrapper {
  max-width: 940px;
  margin: 0 auto;
}

#logo {
  text-align: center;
  margin: 0;
}

h1, h2 {
  color: #fff;
}

nav a {
  margin: 0;
  padding: 10px;
  color: #fff;
}

nav a:hover {
  color: #32673f;
}

h1 {
  font-family: β€˜Changa One’, sans-serif;
  font-size: 1.75em;
  font-weight: normal;
}

img {
  max-width: 100%;
}

#gallery {
  margin: 0;
  padding: 0;
  list-style: none;
}

#gallery li {
  float: left;
  width: 45%;
  margin: 2.5%;
  background-color: #f5f5f5;
  color: #bdc3c7;
}

6 Answers

Geovanie Alvarez
Geovanie Alvarez
21,500 Points

You need to select the unordered list nested inside the nav element and remove the margins on the top and bottom nad set the margins on the left and right to 10px.

nav ul {
  margin: 0 10px;
}

that's all

I understand the assignment and I did that. What I don't understand is why it didn't work.

Thanks! Susan

Geovanie Alvarez
Geovanie Alvarez
21,500 Points

Well in the code that you post you only select the anchor and set the margin to 0 and not the unordered list

Hm. Per the instruction, I'm supposed to select the unordered list. But since this doesn't exist, it's rather hard to select. Since the only existing nav item is the 'nav a' line, I thought that was what I was supposed to 'select' to work with.

Okay, I created the 'nav ul' lines like you provided and it worked great. I didn't have any of this in my notes so I guess I missed something somewhere.

Thanks! Susan

Geovanie Alvarez
Geovanie Alvarez
21,500 Points

This is the only way to learn "making mistake" happen to me a lot.

And I'm certainly making a lot of them.

Now if I can only figure out how to not lose my current work whenever I ask a question...

I've already figured out I have to have all my question material written ahead of clicking the help button because once I've clicked that button, I can't go back to reference anything to include in my question without cancelling the question in progress.

Thanks! Susan