Set opacity of background image without affecting child elements

前端 未结 15 2218
闹比i
闹比i 2020-11-22 01:39

Is it possible to set the opacity of a background image without affecting the opacity of child elements?

Example

All links in the footer need a custom bull

15条回答
  •  走了就别回头了
    2020-11-22 02:38

    Unfortunately, at the time of writing this answer, there is no direct way to do this. You need to:

    1. use a semi-transparent image for background (much easier).
    2. add an extra element (like div) next to children which you want the opaque, add background to it and after making it semi-transparent, position it behind mentioned children.

提交回复
热议问题