CSS3放射狀漸層linear-gradient

來源:互聯網
上載者:User

標籤:

文法:

 

選取器{     background:linear-gradien(線性漸層的方向,起點顏色,終點顏色); }

 

第一個參數:[選擇性參數,預設從上到下] 線性漸層的方向:top,bottom,left,right,top left;

第二個和第三個參數:起點顏色和終點顏色,其實中間可以插入更多的顏色,以實現多色漸層效果;支援直接寫顏色,或16進位顏色

 

 

相容性問題:

支援chrome和Firefox,其他瀏覽器尚未測試,部分支援IE10,

為了支援chrome和Firefox,要分別寫上-webkit-,-moz-

比如:

div{    background:-webkit-linear-gradient(top,red,blue);/*Google*/        background:-moz-linear-gradient(top,red,blue);  /*Firefox*/    background:linear-gradient(top,red,blue);  /*ie10*/         }

之所以說部分支援IE10,是因為我測試時,第一個參數,寫了多種之後,發現IE10隻支援少數的幾種方向。

 

ie6~9的背景色漸層:

其實是用了filter濾鏡來做:

.div{            filter: progid:DXImageTransform.Microsoft.gradient(                GradientType=0,                startColorstr=pink,                endColorstr=black            );            /*IE7*8*9有效*/

其中:GradientType=1代表縱向,0代表橫向

CSS3放射狀漸層linear-gradient

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.