CSS3制作酷炫的條紋背景
發(fā)布時間:2017-11-09 15:29:04 作者:佚名
我要評論

這篇文章主要介紹了CSS3制作酷炫的條紋背景的相關(guān)資料,需要的朋友可以參考下
1. 實現(xiàn)不等寬背景條紋:
.cont{ width: 500px; height: 200px; background: linear-gradient(#78C9DB 70%,#0acf00 0%); background-size: 100% 20px; }
如果想設(shè)置等寬的漸變只需要將開始值和結(jié)束值改為互補(bǔ)
如果你需要等寬切無過渡的漸變,開始和結(jié)束值設(shè)置為50%即可。
如果你想要垂直條紋,你只需要調(diào)整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; }
總結(jié)
以上所述是小編給大家介紹的CSS3制作酷炫的條紋背景,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
- 這篇文章主要介紹了CSS3條紋背景制作的實戰(zhàn)攻略,根據(jù)Forefox瀏覽器和webkit內(nèi)核的瀏覽器兩種情況來分別講解,需要的朋友可以參考下2016-05-31