Setting opacity to background-image and background-colour

前端 未结 2 1809
说谎
说谎 2021-01-23 21:03

Is it possible to keep a background image 100% opacity and make the background-colour 50% opacity?

.smallIcons{
    background-color: #f00;
    opacity: 0.5; //          


        
2条回答
  •  忘了有多久
    2021-01-23 21:13

    Check this Css. Easiest way to do that

     .class {
       background:linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)
        ),url(image.jpg) no-repeat center top;
        }
    

提交回复
热议问题