1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > css3给背景图层加颜色遮罩办法

css3给背景图层加颜色遮罩办法

时间:2019-09-03 07:50:18

相关推荐

css3给背景图层加颜色遮罩办法

web前端|css教程

css3,背景图层,颜色遮罩

web前端-css教程

c 仓储管理系统 源码,vscode多行向前缩进,查看系统ubuntu,tomcat属性文件路径,查看sqlite3库版本号,包子爬虫,php 关键字过滤,徐元seo won图片,怎么下载b2b网站源码,小京东模板楼层修改lzw

(学习视频分享:css视频教学)

android 轮盘抽奖源码,跑vscode程序废电脑吗,pcl安装 ubuntu,tomcat各文件作用,爬虫电影搜索,js文件写php代码,镇江如何进行seo点击查看,目录网站模板lzw

在开发中,有时遇到需要给背景层加颜色遮罩的项目,现在特定总结一下给背景图层加颜色遮罩的方法。

自动写作文 源码,vscode大括号缩进,ubuntu 搜索启动,tomcat下载网盘,uribuilder爬虫,php 糗事百科,宿州seo优化排名电话,响应式网站茶叶,微赞模板开发lzw

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

.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;}

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

.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;}

编程入门!!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。