css3第九集 渐变倒影属性

渐变倒影属性

属性 说明
linear-gradient 线性颜色渐变
radial-gradient 径向颜色渐变
box-reflect 倒影

代码演示

demo

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
<head>
<meta charset="utf-8" />
<style>
/*
渐变倒影属性
|属性|说明|
|linear-gradient|线性颜色渐变|
|radial-gradient|径向颜色渐变|
|box-reflect|倒影|
*/
.linear1 {
width: 300px;
height: 200px;
background: -webkit-linear-gradient(top,red,blue);
background: -moz-linear-gradient(top,red,blue);
}
.linear2 {
width: 300px;
height: 200px;
background: -webkit-linear-gradient(top,red 50%,green 75%,blue 100%);
background: -moz-linear-gradient(top,red 50%,green 75%,blue 100%);
}
.linear3 {
width: 300px;
height: 200px;
background: -webkit-linear-gradient(-45deg,red 50%,green 75%,blue 100%);
background: -moz-linear-gradient(-45deg,red 50%,green 75%,blue 100%);
}
.linear4 {
height: 200px;
background: -webkit-linear-gradient(top,red,orange,yellow,green,cyan,blue,purple);
background: -moz-linear-gradient(-45deg,red 50%,green 75%,blue 100%);
}
.radial1 {
width: 300px;
height: 200px;
background: -webkit-radial-gradient(center center,red,blue);
background: -moz-radial-gradient(center center,red,blue);
}
.radial2 {
width: 300px;
height: 200px;
background: -webkit-radial-gradient(center center,red 25%,green 50%,blue 100%);
background: -moz-radial-gradient(center center,red 25%,green 50%,blue 100%);
}
.radial3 {
width: 300px;
height: 200px;
background: -webkit-radial-gradient(20px 70px,red 25%,green 50%,blue 100%);
background: -moz-radial-gradient(20px 70px,red 25%,green 50%,blue 100%);
}
.radial4 {
width: 300px;
height: 200px;
background: -webkit-radial-gradient(center center,circle,red,blue);
background: -moz-radial-gradient(center center,circle,red,blue);
}
.repeat-linear {
width: 300px;
height: 200px;
background: -webkit-repeating-linear-gradient(top,red,green,red 10%);
background: -moz-repeating-linear-gradient(top,red,green);
}
.repeat-radial {
width: 300px;
height: 200px;
background: -webkit-repeating-radial-gradient(center center,circle,red,green,red 10%);
background: -moz-repeating-radial-gradient(center center,circle,red,green);
}
.white {
width: 200px;
height: 200px;
border-radius: 100px;
box-shadow: -5px 5px 15px #000;
background: -webkit-radial-gradient(140px 60px,#fff,#666);
}
p {
font-size: 36px;
-webkit-box-reflect: below -10px -webkit-linear-gradient(top,transparent 20%,#fff);
-moz-box-reflect: below -10px -moz-linear-gradient(top,transparent 20%,#fff);
}
</style>
</head>
<body>
<div class="linear1"></div><hr />
<div class="linear2"></div><hr />
<div class="linear3"></div><hr />
<div class="linear4"></div><hr />
<div class="radial1"></div><hr />
<div class="radial2"></div><hr />
<div class="radial3"></div><hr />
<div class="radial4"></div><hr />
<div class="repeat-linear"></div><hr />
<div class="repeat-radial"></div><hr />
<div class="white"></div><hr />
<p>aaaaa;bbbbb;ccccc;ddddd</p>
</body>