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

How should I add the padding to the top and bottom of 15px and to the right and left 10px differently?

The question asks me to add padding to the top and bottom of 15px. Then padding of 10px to the left and right. These are the variations that I have tried: padding: 15px 10px; padding: 15 10; padding: 15px 10px 15px 10px; padding: 15 10 15 10;

I get the error that "The top padding is not set to 15px."

css/main.css
a {
  text-decoration: none;
}
nav ul {
 margin: 0 10px; 
 List-style: none;
 Padding: 0;
}
nav li{
  display:inline-block;
  font-weight: 800;
  padding: 15px 10px;
}
#wrapper {
  max-width: 940px;
  margin: 0 auto;
}

#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: 2.5%;
  background-color: #f5f5f5;
  color: #bdc3c7;
}

padding: top right bottom left;

or padding: *;

or padding: top/bottom right/left;

4 Answers

Well, this one is really tricky, in the worst sense of the word. The editor wants this:

nav a {
  color: #fff;
  font-weight: 800;
  padding-top: 15px;
  padding-right: 10px;
  padding-bottom: 15px;
  padding-left: 10px;
}

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

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

nav li {
  display: inline-block;
}

and it won't accept this, even though it's more concise CSS:

  padding: 15px, 10px, 15px, 10px;

Edited: as Kristopher points out, the values for padding can't be comma separated. So it's me, not the editor.

Kristopher Van Sant
Kristopher Van Sant
Courses Plus Student 18,830 Points

Hi jcorum! I'm sorry but I'd have to disagree with you. The problem here is that the shorthand you're using has commas separating each value. There should not be any commas there. The challenge editor will accept correct padding shorthands. I hope that helps clear things up! :)

Tatiana Perry
Tatiana Perry
17,156 Points

I had problems with this one too. Just remember the box model where it goes top - right - bottom - left. On one lesson, it kept giving me bummer message and I had to leave the page, then come back and the same answer finally worked.

padding: 15px 10px;  /* shorthand */
 or 
padding: 15px 10px 15px 10px;

W3 school info on shorthand: http://www.w3schools.com/cssref/pr_margin.asp

jcorum, you were correct. Thanks everyone.

Kristopher, there's no need to be sorry. You are correct!!

I just did the course on CSS Transitions and Transforms, where some of the values are comma-separated, and clearly I forgot to change gears here.

Good catch. I was really puzzled why the editor wouldn't take the concise version, as I thought it should. Nothing like another set of eyes.

Kristopher Van Sant
Kristopher Van Sant
Courses Plus Student 18,830 Points

Thanks jcorum. And I totally understand! it's easy to get things mixed up when you're going back and forth between learning different things. It's happened to me several times too.

I agree, extra eyes are always helpful! After all we're all in this together. :)