CSS3 線性漸變
線性漸變的屬性為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>
點(diǎn)擊加載更多評(píng)論>>