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

VISHAL DEEPAK
VISHAL DEEPAK
3,272 Points

Non-Clickable area between the ul elements

I found that adding padding to the "nav a" elements has made the clickable area bigger. But between two "li" elements they are is some non clickable area. How did this get formed? I tried adding the following code, but the non-clickable area was still there

nav li{
   display:inline-block;
   margin: 0;
}

1 Answer

Ryan Field
PLUS
Ryan Field
Courses Plus Student 21,242 Points

Hi, Vishal. I think I know what is happening. You probably have your code like this:

<ul>
  <li>
    <a href="#">item1</a>
  </li>
  <li>
    <a href="#">item2</a>
  </li>
</ul>

If this is the case, then what is causing the space between the two list items is the space and/or line break between the closing </li> tag of the first item and the opening <li> tag of the second item. There are a few ways you can fix this. First, you could give li a declaration of margin-left: -4px; in your CSS. The other option is to either remove all of the white space/line breaks with the delete key, or comment it out like this:

<ul>
  <li>
    <a href="#">test</a>
  </li><!--  This will comment out the space
  --><li>
    <a href="#">test</a>
  </li>
</ul>