<div class="container">
<div class="earth"></div>
<div class="moon"></div>
</div>
.container {
background-color: black;
width: 500px;
height: 500px;
position: relative;
}
.earth {
width: 200px;
height: 200px;
background: url(../images5/earth.jpg);
background-size: 100% 100%;
/* border: 1px solid red; */
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
/* transform: translate(-50%, -50%); */
margin-top: -100px;
margin-left: -100px;
animation: spin 60s linear infinite;
}
.moon {
width: 300px;
height: 300px;
/* border: 2px dashed red; */
border: none;
position: absolute;
top: 100px;
left: 100px;
border-radius: 50%;
animation: spin 5s linear infinite;
}
.moon::after {
content: "";
display: block;
width: 50px;
height: 50px;
border-radius: 50%;
background: url(../images5/moon.jpg);
background-size: 100% 100%;
position: absolute;
top: 25px;
left: 10px;
}
@keyframes spin {
0% {
rotate: 0deg;
}
100% {
rotate: 360deg;
}
}