![34961432b7505171c4af7cfdf96fb177.png](https://img-blog.csdnimg.cn/img_convert/34961432b7505171c4af7cfdf96fb177.png)
1、实现不等宽背景条纹
![debd6c0c735bf03c841d1374bcdd04d6.png](https://img-blog.csdnimg.cn/img_convert/debd6c0c735bf03c841d1374bcdd04d6.png)
<html lang="en">
<head>
<meta charset="UTF-8">
<style type="text/css">
.cont{
width: 500px;
height: 200px;
background: -webkit-linear-gradient(#78C9DC 70%, #0acfff 0%);
background: -o-linear-gradient(#78C9DC 70%, #0acfff 0%);
background: linear-gradient(#78C9DC 70%, #0acfff 0%);
background-size: 100% 20px;
}
style>
<title>条纹背景title>
head>
<body>
<div class="cont">
div>
body>
html>
其他效果:⑴如果想设置等宽的渐变只需要将开始值和结束值改为互补
⑵如果需要等宽切无过渡的渐变,开始和结束值设置为50%即可。
⑶如果想要垂直条纹,你只需要调整background-size的x、y值即可。
2、瓷砖条纹背景
![8fd314d41e6fc275ff527868405f8744.png](https://img-blog.csdnimg.cn/img_convert/8fd314d41e6fc275ff527868405f8744.png)
<html lang="en">
<head>
<meta charset="UTF-8">
<style type="text/css">
.cont{
width:500px;
height:200px;
background:-webkit-linear-gradient(bottom left, #1E90FF 50%, #98FB98 50%);
background:-o-linear-gradient(bottom left, #1E90FF 50%, #98FB98 50%);
background:linear-gradient(to top right, #1E90FF 50%, #98FB98 50%);
background-size:30px 30px;
}
style>
<title>瓷砖条纹背景title>
head>
<body>
<div class="cont">
div>
body>
html>
3、草地背景
![1713bc22d82563ea11640669401b7a9c.png](https://img-blog.csdnimg.cn/img_convert/1713bc22d82563ea11640669401b7a9c.png)
<html lang="en">
<head>
<meta charset="UTF-8">
<style type="text/css">
.cont{
width:500px;
height:200px;
background:linear-gradient(-45deg,#0acf00 50%,#78C9DB 50%);
background-size:30px 100%;
}
style>
<title>草地背景title>
head>
<body>
<div class="cont">
div>
body>
html>
4、斜条纹背景
![aa3148717cc2ae39e13fc89644b3c50a.png](https://img-blog.csdnimg.cn/img_convert/aa3148717cc2ae39e13fc89644b3c50a.png)
<html lang="en">
<head>
<meta charset="UTF-8">
<style type="text/css">
.cont{
width:500px;
height:200px;
background:repeating-linear-gradient(-45deg,#ADFF2F,#ADFF2F 15px,#D2691E 0,#D2691E 30px);
/*background:repeating-linear-gradient(-45deg,#0acf00,#0acf00 15px,#78C9DB 0,#78C9DB 30px);*/效果相同
background-size: 30px 30px;
}
style>
<title>斜条纹背景title>
head>
<body>
<div class="cont">
div>
body>
html>
另一种条纹效果:
![fd221596b19199288ce4c653943306cc.png](https://img-blog.csdnimg.cn/img_convert/fd221596b19199288ce4c653943306cc.png)
<html lang="en">
<head>
<meta charset="UTF-8">
<style type="text/css">
.cont{
width:500px;
height:200px;
background:repeating-linear-gradient(-45deg,#FA8072,#FA8072 15px,#ADD8E6 0,#ADD8E6 30px);
background-size: 30px 30px;
}
style>
<title>斜条纹背景title>
head>
<body>
<div class="cont">
div>
body>
html>
5、单色斜条纹背景(利用透明度及transparent)
![c6d9f2aafba7422e07a7f9d4bc5e8c4c.png](https://img-blog.csdnimg.cn/img_convert/c6d9f2aafba7422e07a7f9d4bc5e8c4c.png)
<html lang="en">
<head>
<meta charset="UTF-8">
<style type="text/css">
.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);
}
style>
<title>单色斜条纹背景(利用透明度及transparent)title>
head>
<body>
<div class="cont">
div>
body>
html>
6、格子衫背景
![9c4917b79b0c96b5d0725ec1a5d42d5b.png](https://img-blog.csdnimg.cn/img_convert/9c4917b79b0c96b5d0725ec1a5d42d5b.png)
<html lang="en">
<head>
<meta charset="UTF-8">
<style type="text/css">
.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;
}
style>
<title>格子衫背景title>
head>
<body>
<div class="cont">
div>
body>
html>
7、波点背景
![5c33b64ece1c2db7a78c45ff422cae8e.png](https://img-blog.csdnimg.cn/img_convert/5c33b64ece1c2db7a78c45ff422cae8e.png)
<html lang="en"><head> <meta charset="UTF-8"> <style type="text/css"> .cont{ margin:50px; width:500px; height:200px; background:#C71585; 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 }style> <title>波点背景title>head><body> <div class="cont"> div>body>html>
8、棋盘背景
![d860e85f12e6776e9a6ed2162854eb57.png](https://img-blog.csdnimg.cn/img_convert/d860e85f12e6776e9a6ed2162854eb57.png)
<html lang="en">
<head>
<meta charset="UTF-8">
<style type="text/css">
.cont{
width:500px;
height:200px;
background: #fff;
background-image:linear-gradient(45deg,#FF7F50 26%,transparent 0,transparent 75%,#FF7F50 0),
linear-gradient(45deg,#FF7F50 26%,transparent 0,transparent 75%,#FF7F50 0);
background-size:30px 30px;
background-position:0 0,15px 15px;
}
style>
<title>棋盘背景title>
head>
<body>
<div class="cont">
div>
body>
html>
![1446ee89cc65e1c1b724c068e3548366.png](https://img-blog.csdnimg.cn/img_convert/1446ee89cc65e1c1b724c068e3548366.png)
![e2ad0f870181e062deac9f0bf1815e8b.png](https://img-blog.csdnimg.cn/img_convert/e2ad0f870181e062deac9f0bf1815e8b.png)