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 trialMoses Williams III
28,802 PointsNav ul
Can't seem to set the top margin to 0???
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
22,076 PointsTry:
nav ul { margin: 0 10px; }
Gianmarco Mazzoran
22,076 PointsHi,
the property margin:
is the shortend version of:
.your-class {
margin-top:
margin-right:
margin-bottom:
margin-left:
}
if you use the shorthand version:
.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:
.your-class {
margin-top:
}
Moses Williams III
28,802 Pointsit said top and bottom to 0 and left and right to 10px
in my code i wrote
nav a ul { margin: 0 10px; }
Moses Williams III
28,802 PointsDon't select anchor element?
Gianmarco Mazzoran
22,076 PointsThe challenge is asking you Select the unordered list nested inside the nav element, so you don't need to select also the anchor element.
Moses Williams III
28,802 PointsThank you!
Gianmarco Mazzoran
22,076 PointsYou're welcome! Happy coding!