纯 css 实现的彩虹渐变动态背景
ChatGPT 写的彩虹渐变动态背景,效果不错。
效果(gif 图太大就不传了,传个静态的图片吧):
源码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cool Background</title>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
background: linear-gradient(-45deg, #ff0000, #ff8000, #ffff00, #80ff00, #00ff00, #00ff80, #00ffff, #0080ff, #0000ff, #8000ff, #ff00ff, #ff0080, #ff0000);
background-size: 300% 300%;
animation: rainbow 15s ease infinite;
height: 100vh;
width: 100%;
}
@keyframes rainbow {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
</style>
</head>
<body>
</body>
</html>