This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Sun, Earth, and Code Forum

View Course » View Exercise

7 points
529ad629548c35cd6d00f398_904219174
Submitted by
Alexisia
almost 4 years ago

How to make my earth move around sun ?

Guys Im learning Sun,Earth and Code course and I got everything right except my earth orbit I dont know how to fix it .. Can anyone help me with that ? I have tried to upload orbit but its not working how can i set orbit to earth in style.css ?


2 votes

permalink

Mine works fine
HTML:

<body>
    <!-- Right below is an image of the sun -->
    <img id="sun" src="http://goo.gl/dEEssP">

    <!-- Insert the 'earth' on the next line -->
    <img id="earth" src="http://goo.gl/o3YWu9">
    <div id='earth-orbit'>
<img id='earth' src="http://goo.gl/o3YWu9">
</body>

CSS:

html, body {
/* The universe takes up all available space */
width: 100%;
height: 100%;

/* The universe is black */
background-color: black;

}

#sun {
position: absolute;
top: 50%;
left: 50%;

height: 200px;
width: 200px;
margin-top: -100px; 
margin-left: -100px;

border-color: orange;
border-width: 8px;
border-style: solid;
border-radius: 50%;

box-shadow: 0 0 128px red;

}

#earth {
/* Style your earth */
position: absolute;
top: 0;
left: 50%;

height: 50px;
width: 50px;
margin-left: -25px;
margin-top: -25px;

}

#earth-orbit {
/* For Section #2 */
position: absolute;
top: 50%;
left: 50%;

width: 500px;
height: 500px;
margin-top: -250px;
margin-left: -250px;

border-width: 2px;
border-style: dotted;
border-radius: 50%;
-webkit-animation: spin-right 10s linear infinite;

animation: spin-right 10s linear infinite;
}
@-webkit-keyframes spin-right {
100% {
-webkit-transform: rotate(360deg);
}
}

@keyframes spin-right {
100% {
transform: rotate(360deg);
}
}

351 points
52c5551e282ae3bed200203c_941622595
Submitted by
Niels
over 3 years ago


0 votes

permalink

I CONT GET MY EARTH TO MOVE AROUND THE SUN

73 points
52fa42aa80ff3354e700289c_848230251
Submitted by
conreed11
over 3 years ago

1 Comment

81fdd47d7f151a8c7d8323640c01edd4?s=140&d=retro genXtech over 3 years ago

show us your code


0 votes

permalink

I don't even have an Earth it just keeps saying it is wrong

85 points
55bab4aae39efe331f0002e2_950263151
Submitted by
Dhilan
about 2 years ago


-1 votes

permalink

My earth is not moving at all... :-(

HTML:

<html>
<head>
    <link rel="stylesheet" href="style.css" />
</head>

<body>
    <!-- Right below is an image of the sun -->
    <img id="sun" src="http://goo.gl/dEEssP">

    <!-- Insert the 'earth' on the next line -->
    <div id='earth-orbit'>
        <img id='earth' src="http://goo.gl/o3YWu9">
    </div>


</body>

style.css :

html, body {
    /* The universe takes up all available space */
    width: 100%;
    height: 100%;

    /* The universe is black */
    background-color: black;
}

#sun {
    position: absolute;
    /* Positions the top-left corner of the image to be *
    /* in the middle of the box */
    top: 50%;
    left: 50%;

    border-color: orange;
    border-width: 2px;
    border-style: solid;
    border-radius: 50%;

  /* Play with these numbers to see what it does */
    height: 200px;
    width: 200px;
    margin-top: -100px; 
    margin-left: -100px;
}

#earth {
    position: absolute;
    top: 0;
    left: 50%;

    height: 50px;
    width: 50px;
    margin-left: -25px;
    margin-top: -25px;
}

#earth-orbit {
    position: absolute;
    top: 50%;
    left: 50%;

    width: 500px;
    -webkit-animation: spin-right 10s linear infinite;
    -moz-animation: spin-right 10s linear infinite;
    -ms-animation: spin-right 10s linear infinite;
    -o-animation: spin-right 10s linear infinite;
    animation: spin-right 10s linear infinite;
}


@-webkit-keyframes spin-right {
  100% {
    -webkit-transform: rotate(360deg);
       -moz-transform: rotate(360deg);
        -ms-transform: rotate(360deg);
         -o-transform: rotate(360deg);
            transform: rotate(360deg);
  }
}

@keyframes spin-right {
  100% {
    -webkit-transform: rotate(360deg);
       -moz-transform: rotate(360deg);
        -ms-transform: rotate(360deg);
         -o-transform: rotate(360deg);
            transform: rotate(360deg);
  }
}

What did I do wrong ?

631 points
516fd6ecd0aedc810f00116a_166371016
Submitted by
Meester Alex
over 3 years ago

4 Comments

3c6a06657b60b85b394e61f048aa062d?s=140&d=retro Shashwat Sharma over 3 years ago

READ THIS IT WORKS!!!!
OK, I figured it out, and I am soooooooooooooooo mad!!!! ALL YOU HAVE TO DO IS LEAVE IT BLANK!!! I tried everything and then I was like FORGET IT!!! Then I just deleted it then hit save & submit, and it was like way to go! And there was a start next lesson button! So, to answer your question,

just keep position: absolute; as it is and continue with your coding! Just leave it blank!

P.S. You should vote for my answer because it's the only one that actually works!!

81fdd47d7f151a8c7d8323640c01edd4?s=140&d=retro genXtech over 3 years ago

nu uh and its a comment not an answer

Picture Zibbledurts over 3 years ago

I had the same issue at first. It turned out that the code isn't compatible with all browsers. Wouldn't work for me in Firefox, but Safari worked perfectly.

55146f1476b8fe93f1001185_61886478 Anonymous over 3 years ago

stupid noob