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

Holly Holliday
Holly Holliday
1,563 Points

Am I ever going to get this??? I thought I knew this question but it is wrong...

Challenge question: Select the unordered list nested inside the nav element. Remove the margins on the top and bottom. Set the margins on the left and right to 10px.

I thought the answer was: nav { margin: 0 0 10px 10px; }

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

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

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

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

h1, h2 {
  color: #fff;
}

nav a {
  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: 0;
  background-color: #f5f5f5;
  color: #bdc3c7;
}
Christopher Leonard
Christopher Leonard
11,172 Points

Holly,

Notice the question says to target the <i>unordered list</i> inside of the nav.

Also when you do the short-hand of setting the margin: X X X X; The first X is margin-top. The second X is margin-right. Third is margin-bottom. Last is margin-left.

2 Answers

Biwash Lama
Biwash Lama
13,772 Points

Since, it says unordered list under nav elements, you should write: nav ul { margin: 0 10px; }

Merritt Lawrenson
Merritt Lawrenson
13,477 Points

Two things. First, remember about nesting elements. Since you only want to select the unordered list item inside the nav and not any other unordered lists, your selector should be:

nav ul {
  margin: ;
}

Next, set the margins. Remember that the four values go clockwise starting with the top - top, right, bottom, left. Your margins would then be 0 (top), 10 (right), 0 (bottom), and 10 (left).

nav ul {
  margin: 0 10px 0 10px;
}