Change background on list on hover....

Hi all,
I have the code attached with this question, which basically displays a list in a fancy way. Is there any way I can change the background colour when a person hovers over the li or link?


<style type="text/css">
<!--
#menu {
	font-family: Arial, Helvetica, sans-serif;
	color: #666666;
}
#menu li {
	list-style-type: none;
	font-family: Arial, Helvetica, sans-serif;
	color: #BDB688;
	background-color: #E6E3D2;
	border: 1px solid #BDB688;
	font-size: 11px;
	text-decoration: none;
	margin: 4px;
	padding-top: 6px;
	padding-right: 8px;
	padding-bottom: 6px;
	padding-left: 24px;
	background-repeat: no-repeat;
	background-position: 4px 6px;
	width: 150px;
}
#menu li a {
	text-decoration: none;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
	color: #333333;
	font-size: 11px;
}
 
	
-->
</style>
<ul id="menu">
  <li style="background-image:url(images/home.gif)"><a href="application.php?appid=3&amp;pageid=1"><span>Home</span></a></li>
   <li style="background-image:url(../../elements/images/add2.gif)"><a href="application.php?appid=3&amp;pageid=4"><span>Add Profile</span></a></li>
  <li style="background-image:url(../../elements/images/database_record.gif)"><a href="application.php?appid=3&amp;pageid=22"><span>List Profiles</span></a></li>
 
    <li style="background-image:url(../../elements/images/add2.gif)"><a href="application.php?appid=3&amp;pageid=29"><span>Add Company</span></a></li>
    <li style="background-image:url(../../elements/images/calendar.png)"><a href="application.php?appid=3&amp;pageid=19"><span>List Companies</span></a></li>
        <li style="background-image:url(../../elements/images/user.gif)"><a href="ListGroups.php"><span>Groups</span></a></li>
                <li style="background-image:url(../../elements/images/database_record.gif)"><a href="application.php?pageid=44&amp;appid=3"><span>Reports</span></a></li>
  <li style="background-image:url(images/search.gif)"><a href="application.php?appid=3&amp;pageid=24"><span>Search</span></a></li>
</ul>

Open in new window

fox_stattonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RouchieCommented:
Something like this...


#menu li a:hover {background-color:#cc0000; color:white;}

Open in new window

0
fox_stattonAuthor Commented:
Hi,
That doesnt turn the whole LI background different....
0
RouchieCommented:
To do that you need to give the hyperlink property a display:block entry.

This forces the hyperlink to stretch to the full width of the available space.


#menu li a {
        display:block;
        text-decoration: none;
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-weight: bold;
        color: #333333;
        font-size: 11px;
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fox_stattonAuthor Commented:
Just a final comment, it doesnt quite work as exected. I think the padding stop the whole LI from changing colour, any way around this?
0
RouchieCommented:
Take the padding off the list item and put it on the hyperlink itself.

LI should have 0 padding
A should have what is currently on the LI
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.