Log in

View Full Version : Changing Image



wizkidweb
09-18-2006, 07:44 PM
I am using a script in the scripting archive to change stylesheets with a dropdown menu. I have a logo on my site that I want to change color with the different chosen styles. How can I change the image with CSS? :confused:

mburt
09-18-2006, 07:51 PM
Huh? What image? With css?

With JS it's easy:


<img src="image1.png" onmouseover="src = 'image2.png'" onmouseout="src = 'image1.png'">

blm126
09-18-2006, 08:00 PM
You need to create multiple versions of the image to begin with. From there you apply the image as a background on a div(or equivalent) like so.I am going to assume you have a basic understanding of CSS. If not then I suggest you find a quick tutorial.


#logo{
background: #FFF url('somegif.gif') center top no-repeat;
}

with html like this


<div id="logo"></div>

Then just change the style in the alternate sheet.Another option is to use transparency(gif or png) in the image. Then set the background-color: property correctly.

wizkidweb
09-18-2006, 09:41 PM
I tried that but the the image won't appear on the second style. Only on the default style.