編碼的世界 / 優質文選 / 生涯

css中漸變色怎麼設置


2022年5月04日
-   

這篇文章主要介紹了css3編寫瀏覽器背景漸變背景色的方法,現在分享給大家,也給大家做個參考。

css中漸變色怎麼設置
css 給網頁中的背景設置漸變色,css的漸變顏色可以指定固定的兩個顏色之間的線性過渡,這個css3屬性只支持高版本的瀏覽器。//瀏覽器前綴
background: linear-gradient(red, blue);
background: -webkit-linear-gradient(red, blue);
background: -o-linear-gradient(red, blue);
background: -moz-linear-gradient(red, blue);
1、to top :顏色從下往上漸變:
(相關課程推薦:css視頻教程)background:-webkit-linear-gradient(to top, red, blue);
background:linear-gradient(to top,red,blue);
2、to bottom :顏色從上往下漸變:background:-webkit-linear-gradient(to bottom, red, blue);
background:linear-gradient(to bottom,red,blue);
3、to left :顏色從右往左漸變:background:-webkit-linear-gradient(to left, red, blue);
background:linear-gradient(to left,red,blue);
4、to right :顏色從左往右漸變background:-webkit-linear-gradient(to right, red, blue);
background:linear-gradient(to right,red,blue);
5、to right :顏色從左往右漸變background:-webkit-linear-gradient(to right, red, blue);
background:linear-gradient(to right,red,blue);
6、to bototm right :顏色從左上角度到右下角漸變background:-webkit-linear-gradient(to right, red, blue);
background:linear-gradient(to right,red,blue);
7、to top left :顏色從右下角度到左上角漸變background:-webkit-linear-gradient(to right, red, blue);
background:linear-gradient(to right,red,blue);
本文來自css3答疑欄目,歡迎學習!

熱門文章