这次给大家带来CSS3做出条纹大背景,使用CSS3做出条纹大背景的注意事项有哪些,下面就是实战案例,一起来看一下。
1. 实现不等宽背景条纹:

.cont{width: 500px;height: 200px;background: linear-gradient(#78C9DB 70%,#0acf00 0%);background-size: 100% 20px;}
如果想设置等宽的渐变只需要将开始值和结束值改为互补
如果你需要等宽切无过渡的渐变,开始和结束值设置为50%即可。
如果你想要垂直条纹,你只需要调整background-size的x、y值即可。
2.瓷砖条纹背景

.cont{width:500px;height:200px;background:linear-gradient(45deg,#78C9DB 50%,#0acf00 50%);background-size:30px 30px;}
3. 草地背景

.cont{width:500px;height:200px;background:linear-gradient(-45deg,#0acf00 50%,#78C9DB 50%);background-size:30px 100%;}
4. 斜条纹背景

.cont{width:500px;height:200px;background:linear-gradient(-45deg,#0acf00 25%,#78C9DB 0,#78C9DB 50%,#0acf00 0,#0acf00 75%,#78C9DB 0);/*background:repeating-linear-gradient(-45deg,#0acf00,#0acf00 15px,#78C9DB 0,#78C9DB 30px);*/效果相同 background-size: 30px 30px;}
5.单色斜条纹背景(利用透明度及transparent)

.cont{width:500px;height:200px;background:#fff repeating-linear-gradient(30deg,rgba(0,0,0,.5),rgba(0,0,0,.5)15px,transparent 0,transparent 30px);}
6. 格子衫背景

.cont{width:500px;height:200px;background:#fff;background: linear-gradient(90deg,rgba(100,0,0,.5) 50%,transparent 0),linear-gradient(rgba(100,0,0,.5) 50%,transparent 0);background-size: 30px 30px;}
7.波点背景

.cont{margin:50px;width:500px;height:200px;background:#a95f44;background-image:radial-gradient(#fff 30%,transparent 0),radial-gradient(#fff 30%,transparent 0);background-size:20px 20px;background-position:0 0,10px 10px; // 必须是background-size尺寸的1/2}
8.棋盘背景

.cont{width:500px;height:200px;background: #fff;background-image:linear-gradient(45deg,#a95f44 26%,transparent 0,transparent 75%,#a95f44 0),linear-gradient(45deg,#a95f44 26%,transparent 0,transparent 75%,#a95f44 0);background-size:30px 30px;background-position:0 0,15px 15px;}
相信看了本文案例你已经掌握了方法,更多精彩请关注创想鸟其它相关文章!
推荐阅读:
CSS3的鼠标移入图片动态提示效果
css中sticker-footer布局如何使用
以上就是CSS3做出条纹大背景的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1609299.html
微信扫一扫
支付宝扫一扫