All the code I have for now are down there, I'm a beginner in HTML
So, I want these so called "carrot" images to fall down, from the top of the website as a "loading animation", but the only way I've figured out so far, is to create Multiple versions of one image, and give them all a different ID, since I need every carrot to be in a different position on the X cordinate
I figured the way on how to give each picture the same animation though, and I have the animation done, I just need a way, to create all those images, without that much code, or that's the only way, while all the pictures, also need to be in a random position on the X cordinate, or anything you set it as.
This is my HTML part
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS</title>
<link rel="stylesheet" href="stylesheet.css">
</head>
<body>
<div id="mainContainer">
<img id="carrot" src="images/carrot.png" alt="">
<img id="carrot1" src="images/carrot.png" alt="">
<img id="carrot2" src="images/carrot.png" alt="">
<img id="carrot3" src="images/carrot.png" alt="">
</div>
</body>
</html>
CSS PART
#carrot {
width: 56px;
z-index: 0;
position: relative;
right: -10px;
bottom: 0px;
animation-name: fall;
animation-duration: 3s;
animation-delay: 0s;
animation-iteration-count: infinite;
}
#carrot1 {
width: 56px;
z-index: 0;
position: relative;
right: -190px;
bottom: 0px;
animation-name: fall;
animation-duration: 3s;
animation-delay: 0s;
animation-iteration-count: infinite;
}
#carrot2 {
width: 56px;
z-index: 0;
position: relative;
right: -290px;
bottom: 0px;
animation-name: fall;
animation-duration: 3s;
animation-delay: 0s;
animation-iteration-count: infinite;
}
#carrot3 {
width: 56px;
z-index: 0;
position: relative;
right: -500px;
bottom: 0px;
animation-name: fall;
animation-duration: 3s;
animation-delay: 0s;
animation-iteration-count: infinite;
}
@keyframes fall {
0% { transform: translateY(0px); opacity: 1; }
25% { opacity: 1; }
50% { opacity: 0.8; }
100% { transform: translateY(1400px); opacity: 0.3; }
}