The only legal element allowed inside a <ul>
is an <li>
. You cannot have an anchor wrapped around the <li>
. This holds true in HTML5, where an anchor can wrap around other block level elements.
What you have in CSS is nearly there, just add:
a {
text-decoration: none;
display: block;
width: 100%;
height: 100%;
}
And your anchor shall fill the entire space of the <li>
.
Update for 2022: wrapping your li
tags with anchors
is now totally acceptable.