How to dim an image keeping transparency untouched with CSS or JS?

前端 未结 4 903
隐瞒了意图╮
隐瞒了意图╮ 2021-02-13 18:14

Normal approach to dimming an image suggested everywhere is to change it\'s opacity attribute and display something dark under it. However, my image has transparency and is on w

4条回答
  •  醉话见心
    2021-02-13 18:27

    Have you thought of instead of changing the opacity of the image, say putting a div on top of the image with the same size as the image, opacity of 0.3 and a background color of black.

    This may not be what you are looking for though its food for thought.

    Gab

提交回复
热议问题