首页 > 代码库 > css3 渐变效果

css3 渐变效果

复杂渐变生成器地址:http://www.colorzilla.com/gradient-editor/

背景渐变图案地址:http://lea.verou.me/css3patterns/

 

eg:两色线性渐变

background: #fcfcfc; /* Old browsers */
background: -moz-linear-gradient(top, #fcfcfc 0%, #ff0206 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fcfcfc), color-stop(100%,#ff0206)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #fcfcfc 0%,#ff0206 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #fcfcfc 0%,#ff0206 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #fcfcfc 0%,#ff0206 100%); /* IE10+ */
background: linear-gradient(to bottom, #fcfcfc 0%,#ff0206 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=‘#fcfcfc‘, endColorstr=‘#ff0206‘,GradientType=0 ); /* IE6-9 */

 

eg:两色径向渐变

background: #fcfcfc; /* Old browsers */
background: -moz-radial-gradient(center, ellipse cover, #fcfcfc 0%, #ff0206 100%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#fcfcfc), color-stop(100%,#ff0206)); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover, #fcfcfc 0%,#ff0206 100%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover, #fcfcfc 0%,#ff0206 100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover, #fcfcfc 0%,#ff0206 100%); /* IE10+ */
background: radial-gradient(ellipse at center, #fcfcfc 0%,#ff0206 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=‘#fcfcfc‘, endColorstr=‘#ff0206‘,GradientType=1 ); /* IE6-9 fallback on horizontal gradient */

 

eg:三色线性渐变

background: #fff2f2; /* Old browsers */
background: -moz-linear-gradient(top, #fff2f2 0%, #2e71f7 50%, #315263 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fff2f2), color-stop(50%,#2e71f7), color-stop(100%,#315263)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #fff2f2 0%,#2e71f7 50%,#315263 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #fff2f2 0%,#2e71f7 50%,#315263 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #fff2f2 0%,#2e71f7 50%,#315263 100%); /* IE10+ */
background: linear-gradient(to bottom, #fff2f2 0%,#2e71f7 50%,#315263 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=‘#fff2f2‘, endColorstr=‘#315263‘,GradientType=0 ); /* IE6-9 */

 

背景渐变图案--之多八卦渐变(很有意思哦):

background:
radial-gradient(circle at 50% 59%, #D2CAAB 3%, #364E27 4%, #364E27 11%, rgba(54,78,39,0) 12%, rgba(54,78,39,0)) 50px 0,
radial-gradient(circle at 50% 41%, #364E27 3%, #D2CAAB 4%, #D2CAAB 11%, rgba(210,202,171,0) 12%, rgba(210,202,171,0)) 50px 0,
radial-gradient(circle at 50% 59%, #D2CAAB 3%, #364E27 4%, #364E27 11%, rgba(54,78,39,0) 12%, rgba(54,78,39,0)) 0 50px,
radial-gradient(circle at 50% 41%, #364E27 3%, #D2CAAB 4%, #D2CAAB 11%, rgba(210,202,171,0) 12%, rgba(210,202,171,0)) 0 50px,
radial-gradient(circle at 100% 50%, #D2CAAB 16%, rgba(210,202,171,0) 17%),
radial-gradient(circle at 0% 50%, #364E27 16%, rgba(54,78,39,0) 17%),
radial-gradient(circle at 100% 50%, #D2CAAB 16%, rgba(210,202,171,0) 17%) 50px 50px,
radial-gradient(circle at 0% 50%, #364E27 16%, rgba(54,78,39,0) 17%) 50px 50px;
background-color:#63773F;
background-size:100px 100px;

css3 渐变效果