Convert an image to grayscale in HTML/CSS

前端 未结 25 1815
青春惊慌失措
青春惊慌失措 2020-11-22 10:22

Is there a simple way to display a color bitmap in grayscale with just HTML/CSS?

It doesn\'t need to be IE-compatible (and I imagine it won\'t be) -- if

25条回答
  •  遥遥无期
    2020-11-22 10:42

    It's in fact easier to do it with IE if I remember correctly using a proprietary CSS property. Try this FILTER: Gray from http://www.ssi-developer.net/css/visual-filters.shtml

    The method by Ax simply makes the image transparent and has a black background behind it. I'm sure you could argue this is grayscale.

    Although you didn't want to use Javascript, I think you'll have to use it. You could also use a server side language to do it.

提交回复
热议问题