实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<style>
5
#grad1 {
6
    height: 150px;
7
    width: 200px;
8
    background: -webkit-radial-gradient(red, yellow, green); /* Safari 5.1 - 6.0 */
9
    background: -o-radial-gradient(red, yellow, green); /* Opera 11.6 - 12.0 */
10
    background: -moz-radial-gradient(red, yellow, green); /* Firefox 3.6 - 15 */
11
    background: radial-gradient(red, yellow, green); /* 标准的语法(必须放在最后) */
12
}
13
14
#grad2 {
15
    height: 150px;
16
    width: 200px;
17
    background: -webkit-radial-gradient(circle, red, yellow, green); /* Safari 5.1 - 6.0 */
18
    background: -o-radial-gradient(circle, red, yellow, green); /* Opera 11.6 - 12.0 */
19
    background: -moz-radial-gradient(circle, red, yellow, green); /* Firefox 3.6 - 15 */
20
    background: radial-gradient(circle, red, yellow, green); /* 标准的语法(必须放在最后) */
21
}
22
</style>
23
</head>
24
<body>
25
26
<h3>径向渐变 - 形状</h3>
27
28
<p><strong>椭圆形 Ellipse(默认):</strong></p>
29
<div id="grad1"></div>
30
31
<p><strong>圆形 Circle:</strong></p>
32
<div id="grad2"></div>
33
34
<p><strong>注意:</strong> Internet Explorer 9 及之前的版本不支持渐变。</p>
35
36
</body>
37
</html>