0

I have a background image on the <body> block.

I want to make it black and white by using the webkit-filter: grayscale(100%);

But when I'm applying this filter to the body block, all the images on my site becomes black and white too. I want only my background to be black and white. How can I do it?

Danny
  • 5,945
  • 4
  • 32
  • 52
user3724896
  • 139
  • 2
  • 12

1 Answers1

0

Insert an absolutely positioned div and apply the background to that.

<body>
<div id="BG"></div>
....
other code here
....
</body>


#BG{
   position:fixed;
   left:0;
   right:0;
   top:0;
   bottom:0;
   background-image:(yourimage);
   webkit-filter: grayscale(100%);
   z-index:-500;
}

Fiddle: http://jsfiddle.net/m5d5w/6/

Don't forget to add filters for non-webkit browsers too. See: Greyscale Background Css Images

Community
  • 1
  • 1
Nick
  • 10,904
  • 10
  • 49
  • 78