Hi all,
I was reading in a xhtml book that you can use a background image on the background-color property of an a:hover tag.. But it didn't say how to do it, so I was wondering if someone knows the syntax that can make this happen..
Thanks wwright![]()
| SitePoint Sponsor |
Hi all,
I was reading in a xhtml book that you can use a background image on the background-color property of an a:hover tag.. But it didn't say how to do it, so I was wondering if someone knows the syntax that can make this happen..
Thanks wwright![]()




Code:a:hover { background-image:url(yourFile.gif); }
"There's no justice like angry mob justice!" --Seymour Skinner
That doesen't seem to work. Maybe its something I'm doing, heres the code that goes into my css...
--------------------------------------------------------
A:link { color: #6783ad; text-decoration: none; ;}
A:visited { color: #6783ad; text-decoration: none; }
A:hover { background-image:url(http://www.mysite.com/picture.jpg); }
A:active { color: navy; text-decoration: none;}
---------------------------------------------------------
Any thoughts...
Thanks wwright




hmm, instead of using the entire url, try using just the location of the file:
a:hover { background-image:url(images/yourFile.gif); }
"There's no justice like angry mob justice!" --Seymour Skinner



What you are doing wont work in IE, but if you try it in Mozilla if I remember correctly it will work.
I am currently researching a mouseover image change that will work in more than a couple browsers (or at least not break them) and will get back to you on my findings.
Wavelan


I don't know if this is what you are after but there are various ways to apply the CSS rollover:
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> <!-- div a:hover { background-image: url("http://www.w3.org/Icons/valid-css.gif"); width: auto;} div a { background-image: url("http://www.w3.org/Icons/valid-xhtml11.gif"); width: auto;} --> </style> <title>CSS Rollover </title> </head> <body> <p>Hover your mouse over the W3C image to see it change; you also need to make a Transparent *.gif called: clear.gif to stop the missing image warning.</a> <div> <p> <a href="#"><img src="clear.gif" width="88" height="31" border="0" /></a> </p> </div> </body> </html>
Last edited by xhtmlcoder; Dec 2, 2002 at 09:59.
};-) http://www.xhtmlcoder.com/
Thinking Web: Voices of the Community
> March 2013 - SitePoint forums: Spot the Error 3: Calling all Sleuths! Winner Announced!... She knows how to spot simple <code> errors but do you?




that feature must be buggy...i'm using win98 and ie5 and it works fine for me.Originally posted by Wavelan
[B]What you are doing wont work in IE, but if you try it in Mozilla if I remember correctly it will work.
"There's no justice like angry mob justice!" --Seymour Skinner
Bookmarks