国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > CSS > 正文

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

2024-07-11 08:42:03
字體:
供稿:網(wǎng)友

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

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

但是理解起來還是需要一定基礎的。

線性漸變 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 --- 從上到下(默認值)*/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)

/*設置過渡顏色的起始位置*//*從過渡起始位置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);

重復線性漸變: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);/**與上面重復寫漸變有相同的效果*/background-image: repeating-linear-gradient(        to right        , red 0        , red 50px        , yellow 50px        , yellow 100px);

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持武林網(wǎng)。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 库车县| 宣恩县| 鹤山市| 高州市| 竹溪县| 吉林市| 岗巴县| 宣城市| 名山县| 垦利县| 儋州市| 普宁市| 沙坪坝区| 石林| 山阴县| 田阳县| 盐源县| 柯坪县| 郑州市| 西丰县| 广河县| 宜都市| 庄浪县| 长汀县| 腾冲县| 无锡市| 颍上县| 客服| 孝昌县| 珲春市| 本溪| 沧州市| 舒城县| 兴山县| 文登市| 衢州市| 铅山县| 卢龙县| 蕉岭县| 沁源县| 三亚市|