欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

CSS3 background-image顏色漸變的實現(xiàn)代碼

  發(fā)布時間:2018-09-13 15:40:20   作者:蛋撻喵   我要評論
這篇文章主要介紹了CSS3 background-image顏色漸變的實現(xiàn)代碼的相關(guān)資料,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

linear-gradient 是CSS3中一個重要的屬性,初看覺得很簡單,但是別看它簡單,它能實現(xiàn)很多復(fù)雜的圖形。

代碼還是比較簡單的: linear-gradient(65deg,#2b7ce7,#2b7ce7 50%,transparent 0,transparent),linear-gradient(115deg,#2b7ce7,#2b7ce7 50%,transparent 0,transparent)

但是理解起來還是需要一定基礎(chǔ)的。

線性漸變 linear-gradient

基本用法

background-image: linear-gradient(red, yellow, blue, green); 
background-image: linear-gradient(rgba(255, 0, 0, .2), yellow, blue, green);

控制顏色漸變的方向(right, left, top, bottom)

/*
    控制顏色漸變的方向
    to right -- 從左向右
    to top -- 從下到上
    to left -- 從右到左
    to bottom --- 從上到下(默認(rèn)值)
*/
background-image: linear-gradient(to right, red, yellow, blue, green);
background-image: linear-gradient(to top, red, yellow, blue, green);
background-image: linear-gradient(to left, red, yellow, blue, green);
background-image: linear-gradient(to bottom, red, yellow, blue, green);

控制顏色漸變的方向(deg)

/*0deg = to top -- 從下到上*/
background-image: linear-gradient(0deg, red, yellow, blue, green);
/*基于0度順時針旋轉(zhuǎn)45deg*/
background-image: linear-gradient(45deg, red, yellow, blue, green);
/*基于0度逆時針旋轉(zhuǎn)45deg*/
background-image: linear-gradient(-45deg, red, yellow, blue, green);

控制顏色漸變的方向(to)

/*設(shè)置過渡顏色的起始位置*/
/*從過渡起始位置50px開始讓紅色和黃色之間產(chǎn)生顏色漸變效果*/
background-image: linear-gradient(to right, red 50px, yellow, blue, green);
background-image: linear-gradient(to right, red 50px, yellow 50px, blue, green);
background-image: linear-gradient(to right, red 50px, yellow 50px, yellow 100px, blue, green);

重復(fù)線性漸變:repeating-linear-gradient

background-image: linear-gradient(to right
, red 0
, red 50px
, yellow 50px
, yellow 100px
, red 100px
, red 150px
, yellow 150px
, yellow 200px);
/**與上面重復(fù)寫漸變有相同的效果*/
background-image: repeating-linear-gradient(
        to right
        , red 0
        , red 50px
        , yellow 50px
        , yellow 100px
);

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論