How to code an Image Mouse Hover colour change

A great feature to use on your website is to make an image change colour when the user hovers over it with their mouse or cursor. It is especially handy when you are trying to get a customer to click on a particular image, and surprisingly is extremely easy to code with html.

Here is a sample of one I have done recently for a client, where we wanted to draw attention to the button and entice the customers to click it. This is the original image.  (We have set it up to be clickable so the hover feature is present, but clicking it will just re-load this same page)

The raw html coding for the below image is:

<a href=””><img class=”aligncenter” src=”” /></a>

Enquire Today

To change the image so a different image loads when the user hovers on it, simply add the following coding after the SRC= and add the 2nd image url in along with the 1st one, both in the relevant positions:

src=”FIRST IMAGE URL GOES HERE” onmouseover=”this.src=’SECOND IMAGE URL GOES HERE'” onmouseout=”this.src=’FIRST IMAGE URL GOES HERE'”

So the full image html code would change to:

<a href=””> <img class=”aligncenter” src=”” onmouseover=”this.src=’'” onmouseout=”this.src=’'”/></a>

And the final result will be as below: