RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
使用css3怎么给背景图片加颜色遮罩

这篇文章给大家介绍使用css3怎么给背景图片加颜色遮罩,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

永善ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:13518219792(备注:SSL证书合作)期待与您的合作!

方法一:通过定位叠加(注意层级)


      
.wrap1 {     position: relative;     width: 1200px;     height: 400px;     background: rgba(0, 0, 0, .5); } .wrap1 .inner {     position: absolute;     left: 0;     right: 0;     top: 0;     bottom: 0;     background: url(ban8.jpg) no-repeat center center;     background-size: cover;     z-index: -1; }

方法二:通过伪类元素叠加

.wrap2 {     position: relative;     width: 1200px;     height: 400px;     background: url(ban8.jpg) no-repeat center center;     background-size: cover; } .wrap2::before {     content: "";     position: absolute;     left: 0;     right: 0;     bottom: 0;     top: 0;     background-color: rgba(0, 0, 0, .5);     z-index: 2; }

方法三:CSS3颜色叠加background-blend-mode:multiply;(正片叠底)

.wrap3 {     position: relative;     width: 1200px;     height: 400px;     background: url(ban8.jpg) rgba(0, 0, 0, .5) no-repeat center center;     background-blend-mode: multiply; }

拓展:背景模糊加颜色叠加

使用css3怎么给背景图片加颜色遮罩

.wrap4 {
    position: relative;
    width: 1200px;
    height: 400px;
    background: url(ban8.jpg) rgba(0, 0, 0, .5) no-repeat center center;
    background-blend-mode: multiply;
    filter: blur(2px);
    overflow: hidden;
}

关于使用css3怎么给背景图片加颜色遮罩就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


文章题目:使用css3怎么给背景图片加颜色遮罩
文章路径:http://cqwzjz.cn/article/gccpop.html