I'm trying to switch this code to do roll over image buttons instead of just roll over color changing, but I can't get it to work =[
CSS file has this:
#navcontainer {
width: 200px;
}
#navcontainer ul {
margin-left: 0;
padding-left: 0;
list-style-type: none;
font-family: Arial, Helvetica, sans-serif;
}
#navcontainer a{
display: block;
padding: 3px;
width: 160px;
background: url('homebutton.png');
border-bottom: 1px solid #EEE;
}
#navcontainer a:link, #navlist a:visited {
color: #EEE;
text-decoration: none;
}
#navcontainer a:hover {
background: url('LOVEU.jpg');
color: #FFF;
}
HTML file has this:
Try this:
#navcontainer a{
display: block;
padding: 3px;
width: 160px;
border-bottom: 1px solid #EEE;
text-decoration: none;
background: url('homebutton.png');
}
#navcontainer a:link, #navlist a:visited {
color: #EEE;
}
#navcontainer a:hover {
background-image: url('LOVEU.jpg');
color: #FFF;
}
Edit: You might want to try this technique for positioning a single image to get 2 or 3 hover states - http://www.wellstyled.com/css-nopreload-rollovers.html
2007-12-13 09:26:18
·
answer #1
·
answered by daa 7
·
0⤊
0⤋
Instead of applying the style containing the background image apply it to the div.
An anchor does not support background images iirc.
2007-12-13 09:22:40
·
answer #2
·
answered by Martin I 3
·
0⤊
0⤋
In CSS, use the :hover pseudo-class in your selector for your target element .button { // properties for button in normal state } .button:hover { // properties for button when hovered over } Read more about it at the source link
2016-04-09 01:21:06
·
answer #3
·
answered by Anonymous
·
0⤊
0⤋