Convert an image to grayscale in HTML/CSS

前端 未结 25 1822
青春惊慌失措
青春惊慌失措 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条回答
  •  萌比男神i
    2020-11-22 10:44

    be An alternative for older browser could be to use mask produced by pseudo-elements or inline tags.

    Absolute positionning hover an img (or text area wich needs no click nor selection) can closely mimic effects of color scale , via rgba() or translucide png .

    It will not give one single color scale, but will shades color out of range.

    test on code pen with 10 different colors via pseudo-element, last is gray . http://codepen.io/gcyrillus/pen/nqpDd (reload to switch to another image)

提交回复
热议问题