Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

Change background-color on two layers on rollover

4:31 pm on Jan 17, 2008 (gmt 0)

New User

10+ Year Member

joined:Jan 19, 2007
posts: 12
votes: 0

I have a div with two adjacent divs inside. The two insider divs have background colors of #D36530 (div1) and #577994 (div2). I want to have both divs change background colors when any one of them is rolled over. The change to colors would be #98000D (div1) and #D7E6F1(div2). I also need the text color of div2 to change from #ffffff to #646767 at the same time (text color of div1 remains the same). How do I accomplish this?


4:58 pm on Jan 17, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:May 29, 2007
posts: 578
votes: 0

My 'rule of thumb':

HTML for content
CSS for presentation
Javascript (or similar) for behaviour

Deviating from this ought to be a 'considered' decision

I have a hunch that you could achieve the desired behaviour effects via CSS (e.g. pseudo classes [w3schools.com])... but, to me, that seems a bit of a tortuous route compared with the relative simplicity of javascript (or similar)

But then, what do I know?