Pen Settings



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


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


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.


                <div class="container starter sol-system" id="space">
  <div class="sol its-the-sun"></div>
  <div data-distance="57.9" data-speed="0.88" class="planet sol-1"></div>
  <div data-distance="108.2" data-speed="2.25" class="planet sol-2"></div>
  <div data-distance="149.6" data-speed="3.6525" class="planet sol-3"></div>
  <div data-distance="227.9" data-speed="6.87" class="planet sol-4"></div>
  <div data-distance="778.3" data-speed="43.46475" class="planet sol-5"></div>
  <div data-distance="1427" data-speed="107.74875" class="planet sol-6"></div>
  <div data-distance="2871" data-speed="306.81" class="planet sol-7"></div>
  <div data-distance="4497" data-speed="602.6625" class="planet sol-8"></div>



$di-0: 139.1;
$di-1: 0.4878;
$di-2: 1.2104;
$di-3: 1.2760;
$di-4: 0.6787;
$di-5: 3.8400;
$di-6: 1.9500;
$di-7: 1.8120;
$di-8: 1.7530;

$speed-1: 0.88;
$speed-2: 2.25;
$speed-3: 3.6525;
$speed-4: 6.87;
$speed-5: 43.46475;
$speed-6: 107.74875;
$speed-7: 306.81;
$speed-8: 602.6625;

$distance-1: 57.9;
$distance-2: 108.2;
$distance-3: 149.6;
$distance-4: 227.9;
$distance-5: 778.3;
$distance-6: 1427;
$distance-7: 2871;
$distance-8: 4497;

@mixin size($size){
  width: #{$size/10}px;
  height: #{$size/10}px;

@mixin planet_setup($size, $speed, $distance, $id){

  left: calc(50%);
  top: calc(50%);
  transform-origin: center left;
  overflow: visible;
    content: '';
    position: absolute;
    left: #{$distance/10}px;
    top: 0;
    $scale-divisor: .25;
    width: #{$size/$scale-divisor}px;
    height: #{$size/$scale-divisor}px;
    position: absolute;
    border-radius: 100%;
    // transform: translateX(#{$distance/10}px);
    // margin-left: #{$distance/10}px;

  border-radius: 100%;

  @include planet_setup($di-1, $speed-1, $distance-1, 1);
    background-color: brown;
  @include planet_setup($di-2, $speed-2, $distance-2, 2);
    background-color: cyan;
  @include planet_setup($di-3, $speed-3, $distance-3, 3);
    background-color: blue;
  @include planet_setup($di-4, $speed-4, $distance-4, 4);
    background-color: red;
  @include planet_setup($di-5, $speed-5, $distance-5, 5);
    background-color: orange;
  @include planet_setup($di-6, $speed-6, $distance-6, 6);
    background-color: purple;
  @include planet_setup($di-7, $speed-7, $distance-7, 7);
    background-color: darkblue;
  @include planet_setup($di-8, $speed-8, $distance-8, 8);
    background-color: teal;

// boilerplate
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
    @include planet_setup($di-0/100, 0, 0, 0);
    background-color: yellow;
    border-radius: 100%;
    width: #{$di-0/10}px;
    height: #{$di-0/10}px;

  background-color: darken(white, 5);
  color: white;
  background: black;

  width: 100%;
  max-width: 1200px;
  padding: 1rem 2rem;
  margin: 0 auto;
  background: black;
  border: 1px solid white;
  min-height: 75vh;

  margin-top: 2rem;
  // background-color: white;
  // box-shadow: 0px 10px 30px rgba(black, .1);



  const planets = $('.planet');
    const speed = $(this).attr('data-speed');
    const distance = $(this).attr('data-distance');
    let thisCounter = parseInt(distance); // a good starting number
    rotateIt(this, speed, distance);

    function rotateIt(el, speed, distance){
        $(el).css('transform', `rotate(${thisCounter}deg)`);
        rotateIt(el, speed, distance)