Set opacity of background image without affecting child elements

前端 未结 15 2186
闹比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:13

    we can figure out that by not playing with opacity just by using rgba color

    e.g "background-color: rgba(0,0,0, 0.5)"

    Sample :

    Previous Css:

     .login-card {
      // .... others CSS
      background-color: #121e1b;
      opacity: 0.5;
    }
    

    To :

     .login-card {
          // .... others CSS
          background-color: rgba(0, 0, 0, 0.5);
        }
    

提交回复
热议问题