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 Polish the Navigation and Footer

Robbie Singh
Robbie Singh
3,675 Points

Navigation Links

This is my navigation code in CSS:

/*********************** Navigation ************************/

nav { text-align: center; padding:10px 0; margin: 20px 0 0; }

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

nav li { display: inline-block; }

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

However, there have been no changes in the spacing between the links.

Link to page: http://port-80-0l0dq6c6ne.treehouse-app.com/

What do I do?

Shravan Rajagopal
Shravan Rajagopal
6,540 Points

Hi Robbie, Try adding the padding to the list items rather than the ul element. Since each of the a elements sit inside the li element, space has to be added to the list item. This is always confusing when you first start out. Let me know if I'm right

Robbie Singh
Robbie Singh
3,675 Points

Hi Shravan,

can you give me an example of the changes I should make to the code?

Robbie Singh
Robbie Singh
3,675 Points

Nevermind, I just tried it.

It did not space it out. Rather, it changed it into:

Portfolio About Contact

Just like that.

2 Answers

Robbie Singh
Robbie Singh
3,675 Points

Make sure the px is next to the number, ie. 10px(Right) not 10 px (Wrong)

Shravan Rajagopal
Shravan Rajagopal
6,540 Points

For example:

HTML: <!--HEADER--> <div id="header" class="group"> <img src="img/logo.gif" alt="Smells Like Bakin"> <ul class="nav"> <li><a href="#">About</a></li> <li><a href="#">Cupcakes & Prices</a></li> <li><a href="#">Locations</a></li> <li><a href="#">Contact Us</a></li> </ul> </div><!--Header-->

CSS

An unordered list with a class of nav

ul.nav { margin: 120px 0 0 0; list-style: none; float: right; }

Maybe try adding a margin to the List Item

ul.nav li { float: left; margin-right: 40px; }

Giving the link color:

ul.nav li a { color: #FAF3BC; }