利用纯css3实现花格纹理背景

利用纯css3实现花格纹理背景,纯css3实现花格纹理背景是一款无需任何图片和js脚本即可以实现形式多样的花纹背景,包含横向和竖向栅格背景、马赛克背景等等,还可以自己扩展,非常棒的效果。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>纯css3实现花格纹理背景 - blog.bcdon.com素材</title>
<style>
		body {
			font-family: Georgia, serif;	
		}
 
		.stripes {
			height: 250px;
			width: 375px;
			float: left;
 
			margin: 10px;
 
			-webkit-background-size: 50px 50px;
			-moz-background-size: 50px 50px;
			background-size: 50px 50px; /* Controls the size of the stripes */
 
			-moz-box-shadow: 1px 1px 8px gray;
			-webkit-box-shadow: 1px 1px 8px gray;
			box-shadow: 1px 1px 8px gray;
		}
 
		.angled {
			background-color: #ac0;
			background-image: -webkit-gradient(linear, 0 100%, 100% 0,
									color-stop(.25, rgba(255, 255, 255, .2)), color-stop(.25, transparent),
									color-stop(.5, transparent), color-stop(.5, rgba(255, 255, 255, .2)),
									color-stop(.75, rgba(255, 255, 255, .2)), color-stop(.75, transparent),
			 						to(transparent));
			background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,
								transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,
								transparent 75%, transparent);
			background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,
								transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,
								transparent 75%, transparent);
			background-image: linear-gradient(45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,
								transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,
								transparent 75%, transparent);
		}
 
		.angled-135 {
			background-color: #c16;
			background-image: -webkit-gradient(linear, 0 0, 100% 100%,
									color-stop(.25, rgba(255, 255, 255, .2)), color-stop(.25, transparent),
									color-stop(.5, transparent), color-stop(.5, rgba(255, 255, 255, .2)),
									color-stop(.75, rgba(255, 255, 255, .2)), color-stop(.75, transparent),
			 						to(transparent));
			background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,
								transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,
								transparent 75%, transparent);
			background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,
								transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,
								transparent 75%, transparent);
			background-image: linear-gradient(-45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,
								transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,
								transparent 75%, transparent);
		}
 
		.horizontal {
			background-color: #0ae;
			background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.5, transparent), to(transparent));
			background-image: -moz-linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);
			background-image: -o-linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);
			background-image: linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);
		}
 
		.vertical {
			background-color: #f90;
			background-image: -webkit-gradient(linear, 0 0, 100% 0, color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.5, transparent), to(transparent));
			background-image: -moz-linear-gradient(0deg, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);
			background-image: -o-linear-gradient(0deg, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);
			background-image: linear-gradient(0deg, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);
		}
 
		.checkered {
			background-image: -webkit-gradient(linear, 0 0, 100% 100%, color-stop(.25, #555), color-stop(.25, transparent), to(transparent)),
							  -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, #555), color-stop(.25, transparent), to(transparent)),
							  -webkit-gradient(linear, 0 0, 100% 100%, color-stop(.75, transparent), color-stop(.75, #555)),
			  				  -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.75, transparent), color-stop(.75, #555));
			background-image: -moz-linear-gradient(45deg, #555 25%, transparent 25%, transparent),
							  -moz-linear-gradient(-45deg, #555 25%, transparent 25%, transparent),
							  -moz-linear-gradient(45deg, transparent 75%, #555 75%),
			  				  -moz-linear-gradient(-45deg, transparent 75%, #555 75%);
			background-image: -o-linear-gradient(45deg, #555 25%, transparent 25%, transparent),
							  -o-linear-gradient(-45deg, #555 25%, transparent 25%, transparent),
							  -o-linear-gradient(45deg, transparent 75%, #555 75%),
			  				  -o-linear-gradient(-45deg, transparent 75%, #555 75%);
			background-image: linear-gradient(45deg, #555 25%, transparent 25%, transparent),
							  linear-gradient(-45deg, #555 25%, transparent 25%, transparent),
							  linear-gradient(45deg, transparent 75%, #555 75%),
			  				  linear-gradient(-45deg, transparent 75%, #555 75%);
		}
 
		.picnic {
			background-color:white;
			background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, transparent), color-stop(.5, rgba(200, 0, 0, .5)), to(rgba(200, 0, 0, .5))),
							  -webkit-gradient(linear, 0 0, 100% 0, color-stop(.5, transparent), color-stop(.5, rgba(200, 0, 0, .5)), to(rgba(200, 0, 0, .5)));
			background-image: -moz-linear-gradient(transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5)),
					    -moz-linear-gradient(0deg, transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5));
			background-image: -o-linear-gradient(transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5)),
					    -o-linear-gradient(0deg, transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5));
			background-image: linear-gradient(transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5)),
					    linear-gradient(0deg, transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5));
		}
 
		#footer {
			text-align: center;
			clear: both;
			padding-top: .5em;
			border-top: 1px solid #ccc;
			font-variant: small-caps;
		}
	</style>
</head>
 
<body>
 
<div class="horizontal stripes">
</div>
<div class="vertical stripes">
</div>
<div class="picnic stripes">
</div>
<div class="angled stripes">
</div>
<div class="angled-135 stripes">
</div>
<div class="checkered stripes">
</div>
 
<div style="text-align:center;clear:both">
<p>适用浏览器:FireFox、Chrome、Safari、Opera、傲游、搜狗. 不支持IE8、360、世界之窗。</p>
<p>来源:<a href="http://blog.bcdon.com/" target="_blank">卞懂的自留地</a></p>
</div>
 
</body>
 
</html>

发表一条评论:

电子邮件地址不会被公开。 必填项已用*标注