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

Moses Williams III
Moses Williams III
28,802 Points

Nav ul

Can't seem to set the top margin to 0???

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 ul {
  color: #fff;
}

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

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

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;
}

4 Answers

Gianmarco Mazzoran
Gianmarco Mazzoran
22,076 Points

Hi,

the property margin: is the shortend version of:

style.css
.your-class {
  margin-top: 
  margin-right:
  margin-bottom:
  margin-left:
}

if you use the shorthand version:

style.css
.your-class {
  margin: 1px; /* apply margin top, right, bottom, left */

  margin: 1px 2px; /* the first value apply for top and bottom, the second value apply for left and right */

  margin: 1px 2px 3px; /* the first value apply for top, the second value apply for left and right, the third value apply for bottom */

  margin: 1px 2px 3px 4px; /* apply value in clockwise order: top, right, bottom, left */
}

so if you need to style only the top margin it's better to use the margin-top property:

style.css
.your-class {
  margin-top: 
}
Moses Williams III
Moses Williams III
28,802 Points

it said top and bottom to 0 and left and right to 10px

in my code i wrote

nav a ul { margin: 0 10px; }

Gianmarco Mazzoran
Gianmarco Mazzoran
22,076 Points

The challenge is asking you Select the unordered list nested inside the nav element, so you don't need to select also the anchor element.