Tell us what’s happening:
I passed the assignment but my moon doesn’t go around the earth. How can I share my code with you for help with getting the moon to go aroudn the earth without posting solution code?
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>moon</title>
<link href="styles.css" rel="stylesheet"/>
</head>
<body>
<script src="index.js"></script>
<div class="space">
<div class="earth">
</div>
<div class="orbit">
<div class="moon"></div>
</div>
</div>
</body>
</html>
/* file: styles.css */
* {
box-sizing: border-box;
}
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
margin: 0;
padding: 0;
color: white;
}
.space {
width: 200px;
height: 200px;
background-color: black;
margin: 0;
padding: 0;
}
.earth {
width: 100px;
height: 100px;
background-color: blue;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin: 0;
padding: 0;
}
/* Orbit Container */
.orbit {
width: 200px;
height: 200px;
position: absolute;
bottom: 0;
right: 0;
transform: translate(-50%, -50%); /* Centers the orbit within the space */
animation-name: orbit;
animation-duration: 5s;
animation-iteration-count: infinite;
animation-timing-function: linear;
margin: 0;
padding: 0;
color: yellow;
border-radius: 50%; /* Make the orbit a circular path */
}
.moon {
position: absolute;
width: 30px;
height: 30px;
top: 0;
left: 50%;
transform: translateX(-50%);
background-color: lightblue;
border-radius: 50%; /* Make the moon circular */
}
@keyframes orbit {
0% {
transform: rotate(0deg) translate(-50%, -50%);
}
100% {
transform: rotate(360deg) translate(-50%, -50%);
}
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:136.0) Gecko/20100101 Firefox/136.0
Challenge Information:
Build a Moon Orbit - Build a Moon Orbit