<radial-gradient>:radial-gradient([ <position>,]? [ [ <shape> || <size> ] | <shape-size>{2},]? <color-stop>[, <color-stop>]+);
<position>:[ <length>① | <percentage>① | left | center① | right ]? [ <length>② | <percentage>② | top | center② | bottom ]?
<shape>:circle | ellipse
<size>:closest-side | closest-corner | farthest-side | farthest-corner | contain | cover
<shape-size>:<length> | <percentage>
<color-stop>:<color> [ <length> | <percentage> ]?
示例代码:
(图一)
radial-gradient(circle,#f00,#ff0,#080); radial-gradient(center,circle,#f00,#ff0,#080); radial-gradient(50%,circle,#f00,#ff0,#080); radial-gradient(circle,#f00 0%,#ff0 50%,#080 100%); radial-gradient(circle cover,#f00,#ff0,#080);
以上几句代码都可以实现如(图一)的渐变效果
支持版本\类型 | IE | Firefox | Safari | Chrome | Opera |
---|---|---|---|---|---|
版本 | 6.0-9.0 | 4.0 | 5.1 | 13.0 | 11.50-11.51 |
版本 | 10.0 | 11.60 |
内核类型 | 写法 |
---|---|
Webkit(Chrome/Safari) | -webkit-radial-gradient()/-webkit-gradient() |
Gecko(Firefox) | -moz-radial-gradient() |
Presto(Opera) | -o-radial-gradient() |
Trident(IE) | -ms-radial-gradient() |
W3C | radial-gradient() |