I'm creating a horizontal menu in my website and everything is OK but one thing. I have a link in each <li>
and the color is set to white and li
has no background, but in hover I want to set li
background to white and links text color to black. The problem is that the width of <a>
tags is not the same as <li>
and when the mouse is over the part that is in <li>
but not in <a>
both become white.Anchor links can not have width property as far as I know, and I try different type of tricks but no success.Any idea?
#primary-menu ul li {
list-style-type: none;
float: left;
background-image: url('menu-sep.png');
background-repeat: no-repeat;
background-position: right;
}
#primary-menu li a:hover {
color: black;
}
#primary-menu li:hover {
background-color: white;
color: black;
}
#primary-menu li a {
color: white;
text-decoration: none;
padding-right: 8px;
margin-right: 8px;
width: 100%;
height: 23px;
}
`