Background animation using CSS on CodePen.
This example creates a subtle gradient animation:
html
Copy code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Background Animation</title>
<style>
body {
margin: 0;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
background: linear-gradient(45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
background-size: 400% 400%;
animation: gradientAnimation 15s ease infinite;
}
@keyframes gradientAnimation {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
h1 {
font-family: 'Arial', sans-serif;
font-size: 3em;
color: #fff;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
</style>
</head>
<body>
<h1>Background Animation</h1>
</body>
</html>
You can copy and paste this code into a new HTML file and open it in your browser
This example uses a linear gradient and the @keyframes rule to create a background animation that smoothly transitions between different gradient positions,
creating a visually appealing effect. Feel free to customize the colors,
animation duration, or any other styles to suit your needs.