Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-07-2011, 04:21 PM   PM User | #1
DvdBonan
New Coder

 
Join Date: Jan 2011
Posts: 30
Thanks: 3
Thanked 0 Times in 0 Posts
DvdBonan is an unknown quantity at this point
Changing Image Color

Hi there,

can anyone help with a code to change an image from one color to the next? I have the two images. The first is black the second is white. I want the black one to be always showing but when you put your mouse over the image it changes to the white one. I think its called hover over or something like that?
DvdBonan is offline   Reply With Quote
Old 07-07-2011, 04:34 PM   PM User | #2
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
:hover
so if you have two classes
.blah
.hah
you can do .blah:hover .hah{}
*note my syntax may be skewed bc im spoiled and VS fixes it for me
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE
alykins is offline   Reply With Quote
Old 07-07-2011, 05:12 PM   PM User | #3
wojo1086
Regular Coder

 
Join Date: Mar 2010
Location: Orlando, FL
Posts: 153
Thanks: 2
Thanked 8 Times in 8 Posts
wojo1086 is an unknown quantity at this point
If you give your image a class, like class="image1", then the css code would be image.image1:hover {background-image: url("images/image2.png");}

This is the only way I know how to do it off the top of my head. For hover effects I usually put image1 in a div and then give that div a background-image of image1. This is so I can easily have the hover effect I just showed you.
wojo1086 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:31 PM.


Advertisement
Log in to turn off these ads.