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

padding setting to 15px(top and bottom) and 10px(left and right)

I did it as nav li{ padding: 15px 10px; }

Its giving this error- the top padding should be 15px.

pls help.

5 Answers

Jacob Miller
Jacob Miller
12,466 Points

Code challenge says select the links inside the nav element. So your code should be:

nav a {
    font-weight: 800;
    padding: 15px 10px;
}
Richard Duncan
Richard Duncan
5,568 Points

That's not wrong it could be that the challenge is looking for a specific answer. Try padding: 15px 10px 15px 10px;

yes. when I did nav a, it worked. but links inside nav should be nav li, right? thank you Jacob and Richard for quick reply.

Jacob Miller
Jacob Miller
12,466 Points

Well, I didn't look at the html, but I'm assuming that there are anchor elements inside of the list items. So no, the links would not be targeded by nav li. Applying those styles the list items will do pretty much the same thing as applying them to the anchor elements, but nav a is what the challenge was looking for.

Yes. There are anchor elements inside. got it. Thanks!