Link Inside <li> No Working

Jess Eddy picture Jess Eddy · Nov 1, 2011 · Viewed 8.5k times · Source

Pretty simple nut I'm trying to crack. I'm doing image rollovers with CSS only. When I plugged in my a href link, it just does not work. By not work I mean, it does not act like it's a link and as a result you cannon click through to the page. Figuring it has something to do with the <li> but I can't figure out what. Here's my HTML and CSS:

CSS

    ul.navigation,
    ul.navigation ul {
    margin: 25px 0 0 0;
    }
    ul.navigation li {
    list-style-type: none;
    margin:15px;
  }

.AboutUsNav{
    display: block;
    width: 159px;
    height: 54px;
    background: url('../images/N_About_Us.png') bottom;
    text-indent: -99999px;
}
.AboutUsNav:hover {
    background-position: 0 0;
}

HTML

<div>
<ul class="navigation">
<li class="AboutUsNav"><a href="/about">About Phin &amp Phebes Ice Cream</a></li>
<li class="FlavorsNav"><a href="/flavors">Ice Cream Flavors</a></li>
<li class="WheretoBuyNav"><a href="/buy">Where to Buy Our Ice Cream</a></li>
<li class="WholesaleNav"><a href="/wholesale">Wholesale Orders Ice Cream</a></li>
<li class="ContactUsNav"><a href="/contact">Contact Phin &amp; Phebes Ice Cream</a></li>
<li><a href="http://phinandphebes.com/about">about</a></li>

</ul>
</div>

Answer

alex picture alex · Nov 1, 2011

Your .AboutUsNav has text-indent: -99999px;, pulling the a outside of the clickable viewport.

You probably want to put the negative text-indent on the a itself, and then set the a element to display: block; width: 100%; height: 100%, depending on your circumstances.