码迷,mamicode.com
首页 > Web开发 > 详细

css Gradients(渐变)

时间:2015-06-11 17:09:05      阅读:382      评论:0      收藏:0      [点我收藏+]

标签:

渐变分为4类

1:线性渐变(Linear Gradients)- 向下/向上/向左/向右/对角方向

2:径向渐变(Radial Gradients)- 由它们的中心定义

3:对角渐变

4:角度渐变

下面是我写的代码



div{float: left;width: 100px;height:100px;}
.odiv1{
background:-moz-linear-gradient(red,blue);
background:-webkit-linear-gradient(red,blue);
background:-ms-linear-gradient(red,blue);
background:-o-linear-gradient(red,blue);
background:linear-gradient(red,blue);/*线性渐变默认情况下是从上到下*/
}
.odiv2{
background:-moz-radial-gradient(red,blue);
background:-webkit-radial-gradient(red,blue);
background:-ms-radial-gradient(red,blue);
background:-o-radial-gradient(red,blue);
background: radial-gradient(red,blue);/*径向渐变*/
}
.odiv3{/* 标准的语法(必须放在最后) */
background:-webkit-linear-gradient(right,red,blue);
background:-moz-linear-gradient(right,red,blue) ;
background:-ms-linear-gradient(right,red,blue);
background:-o-linear-gradient(right,red,blue);
background: linear-gradient(to right,red,blue);/*从右向左渐变*/
}
.odiv4{/*对角渐变左上角开始(到右下角)的线性渐变*/
background: -webkit-linear-gradient(left top,red,blue);
background:-moz-linear-gradient(bottom right,red,blue);
background: -ms-linear-gradient(bottom right,red,blue);
background: -o-linear-gradient(bottom right,red,blue);
background:linear-gradient(to bottom right,red,blue);
}
.odiv5{/*以60度进行的渐变*/
background:-webkit-linear-gradient(60deg,red,blue);
background:-moz-linear-gradient(60deg,red,blue) ;
background:-ms-linear-gradient(60deg,red,blue);
background:-o-linear-gradient(60deg,red,blue);
background:linear-gradient(60deg,red,blue);
}


<div class="odiv1"></div>
<div class="odiv2"></div>
<div class="odiv3"></div>
<div class="odiv4"></div>
<div class="odiv5"></div>

高手勿喷啊!

css Gradients(渐变)

标签:

原文地址:http://blog.csdn.net/u010061287/article/details/46456843

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!