用html写一个动态背景页面
时间: 2023-09-25 15:12:04 浏览: 52
好的,下面是一个简单的HTML代码示例,它将创建一个动态背景页面,可以根据你的需要进行修改:
```html
<!DOCTYPE html>
<html>
<head>
<title>动态背景页面</title>
<style>
body {
background: linear-gradient(to right, #ff758c, #ff7eb3);
background-size: 400% 400%;
animation: gradient 10s ease infinite;
}
@keyframes gradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
</style>
</head>
<body>
<!-- 这里添加页面内容 -->
</body>
</html>
```
这段代码使用了CSS3的gradient属性来创建一个线性渐变背景,然后使用animation属性来实现动画效果。你可以更改渐变的颜色和方向,以及动画的持续时间和缓动效果来适应你的需求。同时,你需要在body标签内添加你的页面内容。