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!
<div>
s.<a>
tags to havedisplay: block
<li>
to the<a>
.<li>
s will need to be either floated ordisplay: inline-block
Example: http://jsfiddle.net/8yQ57/
Here's what I do:
Then style the anchors as I see fit.
Here's the fiddle: http://jsfiddle.net/erik_lopez/v4P5h/
Just use "display block" for link.
Here's the example http://jsfiddle.net/TWFwA/ :)
I myself just had this problem.
The answer couldn't be simpler:
in other words, you want to apply the css that the LI's had to the A element. Making sure that the A is a block line element
Move the
<a>
tags so that they wrap the<li>
tags. According to this answer, anchor tags must contain inline elements, and it looks like your<li>
's are inline, so this should be valid.a sir you use jquery ? if yes, you can try it :
or you could use it too as css:
Choose one ... Good luck