位置:首頁 > 軟件操作教程 > 編程開發(fā) > CSS > 問題詳情

CSS3 線性漸變

提問人:劉團(tuán)圓發(fā)布時間:2020-11-19

線性漸變的屬性為linear-gradient,默認(rèn)漸變的方向也是從上至下的,語法如下:

background: linear-gradient(direction, color - stop 1, color-stop2,...);


通過一個實例來理解最簡單的線性漸變。

【例題】創(chuàng)建線性漸變

代碼如下:

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Document</title>

<style>

div{

width: 200px;

height: 200px;

background:-ms-linear-gradient(120deg,pink,lightblue,yellowgreen,red);

background:-webkit-linear-gradient(120deg,pink,lightblue,yellowgreen,red);

background:-o-linear-gradient(120deg,pink,lightblue,yellowgreen,red);

background:-moz-linear-gradient(120deg,pink,lightblue,yellowgreen,red);

background:linear-gradient(120deg,pink,lightblue,yellowgreen,red);

}

</style>

</head>

<body>

<div></div>

</body>

</html>

image.png

繼續(xù)查找其他問題的答案?

相關(guān)視頻回答
回復(fù)(0)
返回頂部