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 do I get padding set to 15px recognized?

Error: The top padding for nav links should be 15px.

nav li { display: inline-block; font-weight: 800; padding-top: 15px; margin: 10px; }

I've also tried:

  • padding: 15px;
  • padding: 15px 15px;
  • padding: 15px 0;
  • padding: 0 15px;
  • padding-top: 15px 15px;

but nothing seems to be working. I even tried creating a new 'nav li' but that didn't work either.

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 {
  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;
}
nav ul {  
  margin: 0 10px;
  list-style: none;
  padding: 0;
  display: inline-block;
}
nav li {
  display: inline-block;
  font-weight: 800;
  padding-top: 15px;
  margin: 10px;
}

7 Answers

Geovanie Alvarez
Geovanie Alvarez
21,500 Points

In the nav a (nav links = nav a)

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

Nav a? Well, no wonder. I've been adding to nav li, where all the other work has been done. I'm having trouble keeping these straight. <sigh>

Thanks! Susan

Shawn Flanigan
PLUS
Shawn Flanigan
Courses Plus Student 15,815 Points

Hi Susan,

You're close...I just see 2 little problems.

  1. It looks like you're targeting list items within the nav element (nav li) instead of links within the nav element (nav a). Leave the display and font-weight in nav li and create a new nav a for this step.
  2. The challenge asks you to set the padding for these links to 15px on the top and bottom, and 10px on the right and left. You currently have just the top padding set to 15px and all margins set to 10px. Remember when setting padding and margins, the order goes top, right, bottom, left. So...to set the padding, you 'd want to do something like:
padding: 15px 10px 15px 10px;

If your top and bottom values match and your right and left values match, you can abbreviate it. In this case, the order goes top & bottom, left & right:

padding: 15px 10px;

Hope that helps!

Part of my problem was that I missed the instruction moving to the 'unordered' list instead of the list so I was adding to the previous instruction. Guess I'm not doing well with bouncing around. I also didn't know there were four possible values (only two were covered in the lesson: I thought they were top/bottom and left/right (or vise versa)) so I'll see what I can do adding all four in the mix.

But now I'm really confused. I'm suppose to be setting margins, not padding. So shouldn't I be using the margin property instead of padding?

When I change the nav a code to "padding: 0 15px;" I still get the same error message. Although I get the same error message when I use the margin property as well.

padding: 0 10px; or margin: 0 10px;

Thanks! Susan

Shawn Flanigan
PLUS
Shawn Flanigan
Courses Plus Student 15,815 Points

Susan: You must have quit the challenge and started over. You originally seemed to be asking about Task 4, but now you seem to be asking about Task 1. Here's a summary:

Task 1: Set the margins of nav ul to top & bottom: 0, left & right: 10px.

nav ul {
    margin: 0 10px;
}

Task 2: On the same selector (nav ul) remove the bullet points and any padding.

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

Task 3: Set nav li to display as inline-block.

nav li {
    display: inline-block;
}

Task 4: Set nav links (nav a) to font-weight 800. Set padding of top and bottom to 15px. Left and right padding to 10px;

nav a {
    font-weight: 800;
    padding: 15px 10px;
}

Does that all make sense?

Yes, it makes sense. Unfortunately, it didn't work; I'd tried this earlier with no luck as well. Here's the code snippet:

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

The error is "Bummer! Be sure to set the top margin to 0."

Since I appear to have again lost the ability to edit this code, I'll be rebooting my laptop yet again. Be back in a bit.

Thanks! Susan

Ok, it appears with my going back and forth between the tasks and help me pages, I'd lost work on prior tasks (I was still within the current session) and the error was referencing a prior task, not the current task. So I just copied all your answers in the current task window and the tutorial is happy and letting me continue (yea!).

My task space editing issue still exists however, despite clearing cache, closing all Chrome browser windows, and rebooting my laptop twice. <sigh> This issue sometimes goes away on its own but it's been in existence for two days now and I've no idea what else to try to fix it. If you have any ideas, let me know!

Thanks! Susan