This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Stylesheets > November 2006 > Change Background Color





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Change Background Color
shapper

2006-11-05, 11:32 pm

Hello,

Could someone, please, tell me how to change the background color of
div when the mouse is hover it?

Thanks,
Miguel

Ben C

2006-11-05, 11:32 pm

On 2006-10-19, shapper <mdmoura@XXXXXXXXXX> wrote:
> Hello,
>
> Could someone, please, tell me how to change the background color of
> div when the mouse is hover it?
>
> Thanks,
> Miguel


div:hover {background-color: yellow;}
John Hosking

2006-11-05, 11:32 pm

Ben C wrote:
> On 2006-10-19, shapper <mdmoura@XXXXXXXXXX> wrote:
>
> div:hover {background-color: yellow;}


But I needn't expect this to work on IE (IE <7 anyway). Right?

--
John
Ben C

2006-11-05, 11:33 pm

On 2006-10-19, John Hosking <John@Hosking.name.invalid> wrote:
> Ben C wrote:
>
> But I needn't expect this to work on IE (IE <7 anyway). Right?


Worth a try. Otherwise you have to use JS, for which the standard
function is addEventListener, but in IE you use I think attachEvent
instead.

Then in the handler you just go (roughly):

event.node.style.backgroundColor = "yellow";
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews