纯css实现背景颜色渐变动画,代码及效果图如下。
body {
width: 100wh;
height: 100vh;
color: #fff;
background: linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB);
background-size: 400% 400%;
-webkit-animation: Gradient 15s ease infinite;
-moz-animation: Gradient 15s ease infinite;
animation: Gradient 15s ease infinite;
}
@-webkit-keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
@-moz-keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
@keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
效果图:


这世上从来就没有横空出世的运气,只有不为人知的努力。
这篇博客展示了如何使用CSS代码创建一个背景颜色从#EE7752渐变到#23D5AB的动画效果。通过设置`linear-gradient`背景、`background-size`和`animation`属性,实现了45度角的色彩流动动画,动画周期为15秒,平滑无限循环。
8356

被折叠的 条评论
为什么被折叠?



