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

后端 未结 14 2232
南笙
南笙 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:28

    Simple solution

    if you need to set the gradient to background-image only:

    background-image: url(IMAGE_URL); /* fallback for older browsers */
    
    background-image: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%,rgba(0,0,0,0.6) 100%), url(IMAGE_URL);
    

提交回复
热议问题