As Eric pointed out , you cant alter the image itself with CSS ( anyway IMG is content, an should be used only in that context). Also your CSS is not targeting ANYTHING: img.decor a:hover needs to be a:hover img.decor to target the image in your source code.
For what I get you are trying to achieve, I would do this tho:
When you hover over the image you now should have a gray rectangle the size of the image, as desired. IF I misunderstood and what you wanted was a grayscale version of the image, you will need to create a second version of your image in grayscale and do this:
Greying out the image can be done, but you have to position another element OVER the img to do it – like say, a dummy span off your anchor – which is why I’d move the class to the anchor. (assuming it even needs a class – though that depends on the parent container).
.decor {
position:relative;
overflow:hidden; /* chop off span when not visible */
zoom:1; /* trip haslayout, make IE play nice */
}
.decor img {
display:block; /* remove any oddball paddings/margins from IMG */
}
.decor span {
position:absolute;
display:inline; /* IE state change hover fix */
bottom:0;
right:999em;
width:320px; /* img width */
height:200px; /* img height */
background:#FFF;
opacity:0.35;
-moz-opacity:0.35;
filter:alpha(opacity=35);
}
/*
don't forget active and focus so keyboard users
aren't left out in the cold!
*/
.decor:active span,
.decor:focus span,
.decor:hover span {
display:block; /* IE state change hover fix */
right:0;
}
Untested mind you, but should work. I’ll toss together a working demo of that if I have time.
Basically it just moves the transparent span over the image when you hover the anchor. Making the span monstrous and then bottom-right positioning it makes sure it won’t induce scrollbars without having to worry about stating the actual images size in the CSS.
Actually – duh, just change the opacity on the image so the background shows through on hover.
is open for easy access to the CSS. Valid XHTML 1.0 Strict, would be valid CSS 2.1 if not for the use of filter (or the page itself using expressions), tested working IE 5.5, 6, 7, 8 and 9, FF 3.5 and 4, and the latest flavors each of Opera, Saffy and Chrome.
Hope this helps. Turned out really simple, rather than playing with extra spans or colors, just change the image’s opacity so the background shows through.