渐变
- background-image:linear-gredient([方向],参数1,参数2,参数3.....)
- 取值:
- 参数1:方位
a.方位名词:to right,to left bottom;
b.角度deg,就不用再加to,直接设置角度
- 后面都是颜色值
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>渐变背景</title>
<style>
.box {
width: 300px;
height: 200px;
border: 2px solid orange;
/*
背景颜色渐变 bgi background-image: linear-gradient(参数1, 参数2, 参数3, ....);
参数1:
方位:默认的方位从上到下
1.方位名词:to right,to right bottom
2.角度deg:直接写度数即可,不用再加to
参数2:颜色1;
参数3:颜色2;.....
*/
background-image: linear-gradient(45deg, red, green, blue);
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>