线性渐变
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>线性渐变</title>
<style type="text/css">
.all {
width: 100px;
height: 100px;
border: 1px solid black;
margin: 20px auto;
}
#one {
background-image: linear-gradient(red, yellow, blue);
}
#two {
background-image: linear-gradient(to right, red, yellow, blue);
}
#three {
background-image: linear-gradient(to left bottom, red, yellow, blue);
}
#four {
background-image: linear-gradient(200deg, red, yellow, blue);
}
#five {
background-image: linear-gradient(-200deg, red, yellow, blue);
}
</style>
</head>
<body>
<div class="all" id="one"></div>
<div class="all" id="two"></div>
<div class="all" id="three"></div>
<div class="all" id="four"></div>
<div class="all" id="five"></div>
</body>
</html>
径向渐变
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>径向渐变</title>
<style type="text/css">
.all {
width: 150px;
height: 150px;
border: 1px solid #000000;
margin: 10px auto;
}
#one {
background-image: radial-gradient(ellipse, red, yellow, blue);
}
#two {
/* 颜色结点不均匀分布: */
background-image: radial-gradient(red 20%, yellow 50%, blue 70%);
}
#three {
background-image: radial-gradient(circle, red, yellow, blue);
}
#four {
background-image: radial-gradient(closest-side at 60% 55%, red, yellow, blue)
}
</style>
</head>
<body>
<div class="all" id="one"></div>
<div class="all" id="two"></div>
<div class="all" id="three"></div>
<div class="all" id="four"></div>
</body>
</html>
声明
本人博客的所有东西,部分源于网络书籍和视频,其他的是个人的理解感悟,经过自己整理撰写成博客。
本人博客均只用于个人学习、复习,不作为商业用途,如有侵权,请联系我修改或删除。
联系邮箱:itlaowen@163.com