mouse over images

Associate
Joined
18 Aug 2004
Posts
1,886
Location
midlands
hi,

is there anyway i can make an image change to another image when the mouse hovers over it, with out using javascript??

thanks
nickels
 
You can use CSS to do it as far as I am aware.

use a div and give it a class so it reads something like:
Code:
<div class=img1></div>

then in the css file you could add
Code:
div.img1 {
background:url('http://www.yoursite.com/image.jpg');
}

div.img1:hover {
background:url('http://www.yoursite.com/image2.jpg');
}

never tried it myself but it works in theory if I ahve got the ":hover" part right
 
I don't think that will work.

Anchor links support hover better, especially on older browsers.

Code:
<a class="google" href="www.google.com" title="Click here for Google lol">Google</a>

Code:
a.google:link, a.google:visited, a.google:active, a.google:hover {
  width: 100px;
  height: 100px;
  display: block;
  color: #fff;
  background-image: url(/images/google.gif);
}

a.google:hover {
  background-image: url(/images/google_hover.gif);
}
 
Back
Top Bottom