Changing background of a div

I want to change the background colour of a div.

does the‘’ accept hex colours…?

<div style="background-color:#D52638;" onmouseover="'green';"  onmouseout="'yellow';">

Yes, like this


Or whatever color :slight_smile:

<div style="background-color:#D52638;" onmouseover="'#009ACF';"  onmouseout="'#D526638';">
example 1

<div style="background-color:yellow" onmouseover="'#009ACF';"  onmouseout="'yellow';">
example 2

Example 1 doesn’t work

Example 2 works


You have one too many characters here:


You could do the first example in css only (apart from ie6 of course)

…Looks like I picked the wrong day to quit amphetamines.

tangledman, why use JS when CSS :hover does the same thing?

Because if he wanted to support IE6 then he could only do hover on anchors…though I do agree that the JS should only be used for IE6 and not generalized in the onmouseover obtrusive JS :slight_smile:

ah, i understand