84

I have the following markup,

<ul id="menu">              
    <li><a href="#">Something1</a></li>
    <li><a href="#">Something2</a></li>
    <li><a href="#">Something3</a></li>
    <li><a href="#">Something4</a></li>
</ul>

The <li> is a bit big, with a small image on its left, I have to actually click on the <a> to activate the link. How can I make a click on the <li> activate the link?

Edit1:

ul#menu li
{
    display:block;
    list-style: none;
    background: #e8eef4 url(images/arrow.png) 2% 50% no-repeat;
    border: 1px solid #b2b2b2;
    padding: 0;
    margin-top: 5px;
}

ul#menu li a
{

    font-weight: bold;
    text-decoration: none;
    line-height: 2.8em;
    padding-right:.5em;
    color: #696969;
}
Mateusz Piotrowski
  • 8,029
  • 10
  • 53
  • 79
San
  • 2,316
  • 4
  • 26
  • 35

16 Answers16

133
#menu li { padding: 0px; }
#menu li a { margin: 0px; display: block; width: 100%; height: 100%; }

It may need some tweaking for IE6, but that's about how you do it.

MiffTheFox
  • 21,302
  • 14
  • 69
  • 94
  • Its working, but the text(link) is sticking to the right border, when I gave a padding-right: .5em the is going out of
  • – San Jul 13 '09 at 20:18
  • Keep tweaking and you'll get it looking perfect. Check for negative margins and padding, something probably isn't adding up and its collapsing. Also, make sure you don't have an errant text-align: right; stuck in there. – Curtis Tasker Jul 13 '09 at 20:25
  • I gave the text(link) a right padding by actually giving the the
  • a padding-right:0.5em and having the
  • and having the same background color. But now that .5em right part of
  • is not click able, but that's fine.
  • – San Jul 13 '09 at 20:40