• Answers
  • Web

How do you create a "rollover" graphic in HTML ...

How do you create a "rollover" graphic in HTML without using javascript? I would like to change the image that is being viewed with the mouse hovers over it.


Share Send to a friend Watch Report
 
 

3 Posted Answers
Order by

 
15 helpful answers

Funny, I was sure it was impossible but

looks like you can do it with CSS!
 
305 helpful answers

I was late for work this morning, because I got stuck in Zeno's paradox

Create a link (<a href="">) and give it a class. Define the image as the background image of the class, and use the :hover pseudoclass to change the background image of the link

 
16 helpful answers

Create two CSS style rules: one with a background image for the anchor link in its normal state, and one with an image for the link's hover state:

<style type="text/css">
#mylink { background-image: url(normal.png); }
#mylink:hover { background-image: url(hover.png); }
</style>

<a id="mylink" href="http://example.com">This is a link with a background image</a>

 

The styling could also be in an external css stylesheet. Obviously, change 'mylink', 'normal.png' and 'hover.png' to whatever you've got.

You may want to read this reference of the CSS background property.

Posted 2007-01-23T08:44:30Z
Premasagar was invited by Yedda to answer this question.

Helpful?(2)
Rated as Best Answer

Sign in to participate

Got an answer for nickc316? Would you like to comment on the posted answers, or vote for the one which you think is the best?

Sign up for a free account, or sign in (if you're already a member).

Explore Related Questions

Other people asked questions on similar topics, check out the answers they received:


Q:

Javascript parsed before html?

what is the common browser parsing sequence? does it parse client side script (i.e. javascript) and then the html source or vice ...
Submitted by amiry   3 years ago.
  • viewed 3345 times
Last answer posted 3 years ago by jakecigar


Q:

How to set a black background for an image in web browser?

I have a blog (in blogspot) and I upload there images (and text). I'd like that when an image is clicked and displayed on its own ...
Submitted by DavidAv   1 year ago.
  • viewed 395 times
Last answer posted 1 year ago by DavidAv


Q:

How to embed HTML/JS inside Flash

My web site is a chat service using Javascript and HTML. In order to put my service on MySpace I could create a Flash version, but ...
Submitted by alexp   3 years ago.
  • viewed 14481 times
Last answer posted 17 days ago by Stephen



» More...

Feed - Subscribe to changes to this Q&A Blog
ADVERTISEMENT
  • Answers
  • Web
Copyright © 2006-2009, Yedda Inc. and respective copyright owners · CC License