?
Solved

image swap on img src hrefs

Posted on 2006-04-20
5
Medium Priority
?
680 Views
Last Modified: 2012-06-27
hi

i have been sucessully able to change background images on hrefs using a css a:link class

how can i get images which are hrefs to swap on mouseover.

for example - how would i apply css to change image1.jpg to image2.jpg on hovering.....


<img src="image1.jpg">
0
Comment
Question by:naifyboy123
  • 3
5 Comments
 
LVL 5

Accepted Solution

by:
PhilHow earned 2000 total points
ID: 16503030
Must use event in tag:

<img src="image1.jpg" onmouseover="this.src='image2.jpg'" onmouseout="this.src='image1.jpg'">
0
 
LVL 4

Expert Comment

by:BonRouge
ID: 16504795
I think your talking about a rollover effect.

Have a look at this and see if it helps...

http://bonrouge.com/br.php?page=rollover3
0
 
LVL 4

Expert Comment

by:BonRouge
ID: 16504829
Actually, re-reading what you said, I think PhilHow's answer's OK. Here's another page similar to the one above that has the img tags in the html, but the method is basically the same as the first one - the difference being that in the second one, the  images are shrunk by the CSS to 1px dots so that you can't see them and instead, we see the background image of the 'a' tag.
0
 
LVL 4

Expert Comment

by:BonRouge
ID: 16504833
Sorry...

Here's that other page, if you're interested... http://bonrouge.com/br.php?page=rollover2
0
 

Author Comment

by:naifyboy123
ID: 16516968
thanks guys - PhilHow's answer is the easiest and lowest maintenance.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses
Course of the Month15 days, 9 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question