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

Chris Boehme
Chris Boehme
480 Points

I can't get past this challenge with top padding

It keeps telling me to add 15 pixels of top padding on the top and bottom of the navigation links. I've done the following code:

nav li { padding-top: 15px 0 15px 0; }

I can't figure out why it isn't working

Chris Boehme
Chris Boehme
480 Points

These are the directions: "Select the links inside the nav element and set their font weight to 800. Then, set padding on the top and bottom to 15 pixels. Set the padding on the left and right to 10 pixels."

I thought the correct code would be:

nav li { font-weight: 800; padding-top: 15px; padding: 0 10px; }

Is this not correct ?

Chris Boehme
Chris Boehme
480 Points

I figured out my issue ~ I didn't need to worry with padding-top and it should have been "nav a" as the selector:

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

Sorry for the bother

5 Answers

Sreng Hong
Sreng Hong
15,083 Points

Hi Chris. The challenge is asked to select the link inside the navigation, but you select the list inside the navigation. So it should be like this:

nav a {

}
Sreng Hong
Sreng Hong
15,083 Points

Also, you use a wrong property. It should be only padding.

you have used padding-top. Change it to just padding.

like this:

nav li {padding: 15px 0;}

Hope this helps!

Steven Byington
Steven Byington
13,584 Points

since you are adding to the top and bottom you only need one number. You also said padding-top, and then declared padding for all for sides. It should look something like this.

nav li { padding: 15px 0; }

Oh, thanks for correction Sreng!

I’m sorry for giving bad advice :(

Chris Boehme
Chris Boehme
480 Points

These are the directions: "Select the links inside the nav element and set their font weight to 800. Then, set padding on the top and bottom to 15 pixels. Set the padding on the left and right to 10 pixels."

I thought the correct code would be:

nav li { font-weight: 800; padding-top: 15px; padding: 0 10px; }

Is this not correct ?

Steven Byington
Steven Byington
13,584 Points

The links inside the nav element would be

nav a {}

the padding for top and bottom is the same, so you can just use one number to represent both. Your code should look like this.

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