I know this has been up a lot of times before, but I couldn't find any solution in my specific case.
I've got a navigation bar and I want the whole <li>
's to be "linked" or "clickable" if you will. Now only the <a>
(and the <div>
's I've fiddled with) is "clickable".
I've tried the li a {display: inner-block; height: 100%; width: 100%}
method but the results where just horrible.
The source can be found here: http://jsfiddle.net/prplxr/BrcZK/
HTML
<!DOCTYPE html>
<html>
<head>
<title>asdf</title>
</head>
<body>
<div id="wrapper">
<div id="menu">
<div id="innermenu">
<ul id="menulist">
<li class="menuitem"><a href="index.php"><div class="menulink">Lnk1</div></a></li>
<li class="menuitem"><a href="index.php"><div class="menulink">Lnk2</div></a></li>
<li class="menuitem"><a href="index.php"><div class="menulink">Lnk3</div></a></li>
<li class="menuitem"><a href="index.php"><div class="menulink">Lnk4</div></a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
Do anyone have a neat solution to this?
Thank you in advance!
Just format the
a
directly instead of theli
with your styles.I have alterd your fiddle http://jsfiddle.net/BrcZK/1/
I think you may have meant
inline-block
, notinner-block
:Also,
inline-block
has its own set of problem with older IE browsers, and probably won't react how you'd expect.You should make the
a
elementsdisplay:block
ordisplay:inline-block
.