css3的背景颜色渐变@线性渐变

 背景颜色渐变之线性渐变

    语法形式: firefox浏览器      background:-moz-linear-gradient(position/deg,startColor,endColor);

         opera浏览器        background: -o-linear-gradient(position/deg,startColor,endColor);

         safari和chrome浏览器    background: -webkit-linear-gradient(position/deg,startColor,endColor);//新版本

         在ie下主要通过滤镜实现。??

    事例:第一个参数为角度或者top、left等位置参数,但是因为top、left的变化较单一,所以一般使用角度作为参数,更利于实现多种渐变。

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4     <title>css3</title>
 5 </head>
 6 <style type="text/css">
 7     .example{
 8         width:100%;
 9         height:500px;
10         background: linear-gradient(45deg,red,blue);
11         background: -webkit-linear-gradient(45deg,red,blue);
12         background: -o-linear-gradient(45deg,red,blue);
13         background: -moz-linear-gradient(45deg,red,blue);
14     }
15 </style>
16 <body>
17 <div class="example">
18     111
19 </div>
20 </body>
21 </html>

    当指定的角度时,该角度为一个由水平线与渐变线产生的的角度,逆时针方向。因此,使用0deg将产生一个左到右水平渐变,而90度将创建一个从底部到顶部的垂直渐变。

参考:http://www.w3cplus.com/content/css3-gradient

 

转载于:https://www.cnblogs.com/yan-ck/p/5802287.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值