標籤:
背景色彩坡形之線性漸層
文法形式: 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 11119 </div>20 </body>21 </html>
當指定的角度時,該角度為一個由水平線與漸層線產生的的角度,逆時針方向。因此,使用0deg將產生一個左到右水平漸層,而90度將建立一個從底部到頂部的垂直漸層。
參考:http://www.w3cplus.com/content/css3-gradient
css3的背景色彩坡形@線性漸層