css3如何给背景图片加颜色遮罩

  第一种:
width: 140px; height: 140px; background
-blend-mode: multiply; filter: blur(2px); overflow: hidden;
 第二种:
    position: relative;
    width: 140px;
    height: 140px;
    background: url(bg.jpg) rgba(0, 0, 0, .5) no-repeat center center;
    background-blend-mode: multiply;

  

第三种:
<div class="box">
     <div class="inner"> </div>
</div>
.box{
    position: relative;
    width: 1200px;
    height: 400px;
    background: rgba(0, 0, 0, .5);
}

.box .inner {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: url(bg.jpg) no-repeat center center;
    background-size: cover;
    z-index: -1;
}
   

猜你喜欢

转载自www.cnblogs.com/mrbabibo/p/11796530.html
今日推荐