首页 > 代码库 > CSS3背景线性渐变

CSS3背景线性渐变

5.背景线性渐变:background-gradient

(1)linear:线性渐变,

谷歌浏览器:(webkit)

background:-webkit-gradient(linear ,0 0,0 80% , from(#fff),  to(#000));(水平渐变)

background:-webkit-gradient(linear ,0 0, 80% 0 , from(#fff),  to(#000));(垂直渐变)

background:-webkit-gradient(linear ,0 0, 300 300 , from(orangeed),  to(blue));(成斜线渐变)

火狐浏览器:

background:-moz-linear-gradient(left , #fff , #000 );颜色渐变是从右到左(黑-白)

background:-moz-linear-gradient(right , #fff , #000 );颜色渐变是从左到右(黑-白)

background:-moz-linear-gradient(top , #fff , #000 );颜色是从下到上渐变(黑-白)

background:-moz-linear-gradient(top ,right , #fff , #000);颜色从下到上,从左到右(黑-白)

(2)环形渐变:

background:radial-gradient(circle , #fff , #ffo , #080);(circle值100px , 100px一样时为圆)

background:radial-gradient(ellipse , #fff , #ffo , #080);(ellipse值为100px , 50px不一样时为椭圆)

代表渐变的图形效果(图形或者椭圆形),可以使用英文或者坐标点

CSS3背景线性渐变