<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Puzzle Animation</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #f0f0f0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden;
}
.puzzle-container {
position: relative;
width: 300px;
height: 200px;
}
.puzzle-piece {
position: absolute;
width: 50px;
height: 50px;
background-color: #000;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
border-radius: 8px;
animation: float 4s ease-in-out infinite;
}
.purple {
background-color: purple;
left: 20%;
top: 10%;
}
.yellow {
background-color: yellow;
left: 50%;
top: 30%;
}
.teal {
background-color: teal;
left: 75%;
top: 20%;
}
.red {
background-color: red;
left: 30%;
top: 60%;
}
@keyframes float {
0% {
transform: translateY(0) rotate(0deg);
}
25% {
transform: translateY(-50px) rotate(15deg);
}
50% {
transform: translateY(0) rotate(0deg);
}
75% {
transform: translateY(50px) rotate(-15deg);
}
100% {
transform: translateY(0) rotate(0deg);
}
}
</style>
</head>
<body>
<div class="puzzle-container">
<div class="puzzle-piece purple"></div>
<div class="puzzle-piece yellow"></div>
<div class="puzzle-piece teal"></div>
<div class="puzzle-piece red"></div>
</div>
<script src="script.js"></script>
</body>
</html>