更多内容,请访问我的 个人博客。
CSS3 渐变(gradients)可以在两个或多个指定的颜色之间显示平稳的过渡。
CSS3 定义了两种类型的渐变(gradients):
- 线性渐变(Linear Gradients)- 向下/向上/向左/向右/对角方向
- 径向渐变(Radial Gradients)- 由它们的中心定义
.gradual{
background: linear-gradient(red, orange);
}
.gradual{
background: linear-gradient(to right, red, orange);
}
.gradual{
background: linear-gradient(to bottom right, red, orange);
}
.gradual{
background: linear-gradient(60deg, red, orange);
}
.gradual{
background: linear-gradient(red, orange, yellow);
}
.gradual{
background: linear-gradient(red, orange, yellow, green, blue, indigo, violet);
}
.gradual{
background: linear-gradient(rgba(255,0,0,1), rgba(255,0,0,0));
}
.gradual{
background: repeating-linear-gradient(red, orange, yellow 10%);
}
.gradual{
background: radial-gradient(red, orange, yellow);
}
.gradual{
background: radial-gradient(red 5%, orange 20%, yellow 80%);
}
.gradual{
background: repeating-radial-gradient(red, orange, yellow 10%);
}