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

CSS3 線性漸變

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

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

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


通過(guò)一個(gè)實(shí)例來(lái)理解最簡(jiǎn)單的線性漸變。

【例題】創(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ù)查找其他問(wèn)題的答案?

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