Gradient over img tag using css

后端 未结 4 1331
孤独总比滥情好
孤独总比滥情好 2020-12-31 00:42

I want to place a gradient over an tag. src attribute of the tag is angular-item. For example:

4条回答
  •  -上瘾入骨i
    2020-12-31 01:04

    I recommend you to set background-color:black; to your container and then set class img{opacity:0.4}. Then you will get the same effect as you got with

    backgroundImage:linear-gradient(rgba(0, 0, 0, 0.8),rgba(0, 0, 0, 0.8),rgba(0, 0, 0, 0.8),rgba(0, 0, 0, 0.8)),url(img_url))
    

    My example on Slide:

    .Slide {
        position: relative;
        border: 1px solid blue;
        min-width: 100%;
        height: 100%;
        transition: 0.5s;
        background-color: rgb(0, 0, 0);
    }
    
    .Slide img{
        position: relative;
        border: 1px solid blue;
        min-width: 100%;
        height: 100%;
        transition: 0.5s;
        opacity: 0.4;
    }
    

提交回复
热议问题