Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <body>
<div id="sun" ></div>
  <!-- Insert the 'earth' on the next line -->
   <div id="earth-orbit">
     <div id="earth"></div>
       <div id="moon-orbit">
         <div id="moon"></div>
         </div>
   </div>
</body>
     
   
     
     
              
            
!

CSS

              
                html, body {
    /* The universe takes up all available space */
    width: 100%;
    height: 100vh;
    overflow:hidden;
    
    /* 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%;
    
    /* Play with these numbers to see what it does */
    height: 200px;
    width: 200px;
    margin-top: -100px; 
    margin-left: -100px;
    
    border-color: orange;
    border-width: 1px;
    border-style: solid;
    border-radius: 50%;
    
    box-shadow: 0 0 128px red;
    background: yellow;
    cursor: help;
}

#earth {
    /* Style your earth */
    position: absolute;
    top: 0;
    left: 50%;
    
    height: 50px;
    width: 50px;
    margin-left: -25px;
    margin-top: -25px;
    
    border-color: blue;
    border-width: 0px;
    border-style: solid;
    border-radius: 50%;
    
    -webkit-box-shadow: 0px 0px 20px 0px rgba(255, 255, 255, 0.5);
-moz-box-shadow:    0px 0px 20px 0px rgba(255, 255, 255, 0.5);
box-shadow:         0px 0px 20px 0px rgba(255, 255, 255, 0.5);
  background: lightblue;
}

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

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

    border-width: 0px;
    border-style: dotted;
    border-color: white;
    border-radius: 50%;

    //animation: spin-right 10s linear infinite;
}

#moon {
    /* Style your earth */
    position: absolute;
    top: 0;
    left: 50%;
    
    height: 20px;
    width: 20px;
    margin-left: -25px;
    margin-top: -25px;
    -webkit-border-radius: 15px;
    -moz-border-radius: 15px;
    border-radius: 15px;
    
    -webkit-box-shadow: 1px 1px 16px 0px rgba(255, 255, 255, .6);
    -moz-box-shadow:    1px 1px 16px 0px rgba(255, 255, 255, .6);
    box-shadow:         1px 1px 16px 0px rgba(255, 255, 255, .6);
    background: lightgray;
}

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

    width: 110px;
    height: 80px;
    margin-top: -285px;
    margin-left: -45px;

    border-width: 0px;
    border-style: dotted;
    border-color: white;
    border-radius: 50%;
    
    //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);
  }
}
              
            
!

JS

              
                // 1. Use querySelector to assign the earth-orbit div to a variable named earthOrbit, and the moon-orbit div to a variable named moonOrbit
// 2. Write a function named beginOrbit that adds the following CSS code to the earth-orbit div: "animation: spin-right 10s linear infinite;"
// 3. Write a function named beginMoonOrbit that adds the following CSS code to the moon-orbit div: "animation: spin-right 10s linear infinite;"
// 4. Within the beginOrbit function, execute the beginMoonOrbit function after adding the CSS code
// 5. Program the beginOrbit function to execute when the body of the HTML is clicked on 

              
            
!
999px

Console