Can I set background image and opacity in the same property?

后端 未结 14 1941
南笙
南笙 2020-11-22 07:58

I can see in CSS references how to set image transparency and how to set a background image. But how can I combine these two in order to set a transparent background image?<

相关标签:
14条回答
  • 2020-11-22 08:46

    I came across this post as I had the same issue then I thought why mess about with css, adjusting values and hitting refresh when you can easily adjust the opacity in Photoshop? Copy the image, paste it as a new layer then move the opacity slider.

    0 讨论(0)
  • 2020-11-22 08:47

    In your CSS add...

     filter: opacity(50%);
    

    In JavaScript use...

     element.style.filter='opacity(50%)';
    

    NB: Add vendor prefixes as required but Chromium should be fine without.

    0 讨论(0)
提交回复
热议问题