How can I make an HTML list item and its background a link?

  • Thread starter Thread starter omg00dness
  • Start date Start date
O

omg00dness

Guest
I made a list (<ul>) with css and html. It's simply a navigation bar with no bullets and a background that looks like a button. The text is clickable but the button behind the text (a background image of the list item) is not. I want to make it clickable with the same link the text has. I can use PHP if I need to.
 
Add <a> tags to the listitems and then use CSS to resize them to the complete area of the listitem.
Gonna need to turn <a> into a block element though.. as inline elements can't normally have a height.

example:

a.menuitem {
display: block;
width: 100%;
height: 100%;
}
....
....
<li><a class="menuitem" href="#">Text</a></li>


Hope this works for you
 
Back
Top