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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <div class="universe-wrapper">
  <div class="stars-wrapper"></div>
  <div class="planets-wrapper">
    <div class="sun"></div>
    <div class="mercury"></div>
    <div class="venus"></div>
    <div class="earth"> </div>
    <div class="mars"> </div>
    <div class="jupiter"></div>
    <div class="saturn"></div>
    <div class="uranus"></div>
    <div class="neptune"></div>
    <div class="pluto"></div>
  </div>
</div>
              
            
!

CSS

              
                @mixin transform($info) {
  transform: $info;
  -webkit-transform: $info;
  -moz-transform: $info;
  -ms-transform: $info;
}
@mixin gradient($type, $info) {
  background: #{$type}-gradient($info);
  background: -webkit-#{$type}-gradient($info);
  background: -moz-#{$type}-gradient($info);
  background: -ms-#{$type}-gradient($info);
}
@mixin browsers($info) {
  animation: $info;
  -webkit-animation: $info;
  -moz-animation: $info;
  -ms-animation: $info;
  -o-animation: $info;
}
@mixin blur($info) {
  filter: blur($info);
  -webkit-filter: blur($info);
  -moz-filter: blur($info);
  -ms-filter: blur($info);
  -o-filter: blur($info);
}
@mixin animation($name) {
  @keyframes #{$name} {
    @content;
  }
  @-webkit-keyframes #{$name} {
    @content;
  }
  @-moz-keyframes #{$name} {
    @content;
  }
  @-ms-keyframes #{$name} {
    @content;
  }
}

/* colors */
$sky: #363640;
$sun: #F2BC46;

$mercury: #76777A;

$venus: #D1734B;
$venus-extra: #E6AF97;

$earth-sea: #496282;
$earth-green: #5E8249;

$mars: #C25447;

$jupiter-1: #E89150 + 50;
$jupiter-2: #E89150;
$jupiter-3: #D16F1B;

$saturn: #D1AA5E;

$uranus: #9DB1BF;

$neptune: #5870A8;

$pluto: #805F47;
$pluto-2: #854339 - 10;

body {
  background-color: $sky;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  width: 100vw;
}

.planets-wrapper {
  bottom: 0;
  height: 125px;
  left: 0;
  margin: auto;
  position: absolute;
  right: 0;
  top: 0;
  width: 1050px;
}

.sun {
  background-color: $sun;
  border-radius: 100%;
  height: 150px;
  opacity: 0.8;
  position: absolute;
  width: 150px;
  &:before {
    border-radius: 100%;
    content: '';  
    height: 175px;
    left: -12.5px;
    opacity: 0.3;
    position: absolute;
    top: -12.5px;
    width: 175px;
    z-index: -1;
    @include blur(1px);
    @include gradient(radial,($sun, $sun + 25));
    @include browsers(sunshine 3s linear infinite);
  }
}

.mercury {
  background-color: $mercury;
  border-radius: 100%;
  box-shadow: inset -3px -3px $mercury - 15;
  height: 40px;
  left: 190px;
  position: absolute;
  top: 42.5px;
  width: 40px;
  @include browsers(mercuryJump 3.2s linear infinite);
  &:before {
    background-color: $mercury - 15;
    border-radius: 100%;
    content: '';
    height: 7px;
    left: 6px;
    position: absolute;
    top: 23px;
    width: 7px;
  }
  &:after {
    @extend .mercury:before;
    height: 5px;
    left: 20px;
    top: 6px;
    width: 5px;
  }
}

.venus {
  border-radius: 100%;
  height: 55px;
  left: 265px;
  position: absolute;
  top: 35px;
  width: 55px;
  @include browsers(venusJump 2.82s -2s linear infinite);
  @include gradient(linear, ($venus + 20 5px, $venus - 15 15px, $venus 25px, $venus + 25 40px, $venus - 10 45px));
  @include transform(rotate(30deg));
}

.earth {
  @extend .mercury;
  background-color: $earth-sea;
  box-shadow: inset -3px -3px $earth-sea - 15;
  height: 50px;
  left: 345px;
  top: 40px;
  width: 50px;
  @include browsers(earthJump 2.76s -1.4s linear infinite);
  &:before {
    background-color: $earth-green;
    border-radius: 100% 70% 100% 70%;
    content: '';
    height: 32px;
    left: 3px;
    position: absolute;
    top: 15px;
    width: 15px;
    @include transform(rotate(-30deg));
  }
  &:after {
    @extend .earth:before;
    height: 12px;
    left: 27px;
    top: 3px;
    width: 10px;
    @include transform(rotate(-45deg));
  }
}

.mars {
  @extend .earth;
  background-color: $mars;
  box-shadow: inset -3px -3px $mars - 15;
  height: 42px;
  left: 430px;
  top: 45px;
  width: 42px;
  @include browsers(marsJump 2.89s -3.1s linear infinite);
  &:before {
    background-color: $mars - 20;
    border-radius: 100%;
    height: 12px;
    left: 20px;
    top: 23px;
    width: 12px;
  }
  &:after {
    @extend .mars:before;
    height: 9px;
    left: 5px;
    top: 10px;
    width: 9px;
  }
}

.jupiter {
  @extend .earth;
  box-shadow: 0px 0px 0px;
  height: 80px;
  left: 495px;
  top: 25px;
  width: 80px;
  @include browsers(jupiterJump 2.05s -4.32s linear infinite);
  @include gradient(linear, ($jupiter-2 5px, $jupiter-1 10px, $jupiter-3 30px, $jupiter-1 50px, $jupiter-3 55px, $jupiter-1 70px, $jupiter-2 75px));
  &:before, &:after {
    height: 0;
  }
}

.saturn {
  @extend .earth;
  background-color: $saturn;
  box-shadow: inset -3px -3px $saturn - 25;
  height: 65px;
  left: 635px;
  top: 35px;
  width: 65px;
  @include browsers(saturnJump 2.25s -2.87s linear infinite);
  &:after {
    background-color: transparent;
    border-bottom: 10px solid $saturn - 40;
    border-left: 10px solid $saturn - 40;
    height: 55px;
    left: -5px;
    top: -3px;
    width: 55px;
    @include transform(rotate(-45deg) skew(65deg));
  }
  &:before {
    @extend .saturn:after;
    border-top: 10px solid $saturn - 40;
    border-right: 10px solid $saturn - 40;
    border-left: 0;
    border-bottom: 0;
    z-index: -1;
  }
}

.uranus {
  @extend .saturn;
  background-color: $uranus;
  box-shadow: inset -3px -3px $uranus - 25;
  height: 67px;
  left: 765px;
  top: 34px;
  width: 67px;
  @include browsers(uranusJump 2.73s -5.12s linear infinite);
  &:after, &:before {
    border: 0;
  }
}

.neptune {
  @extend .uranus;
  background-color: $neptune;
  box-shadow: inset -3px -3px $neptune - 25;
  height: 60px;
  left: 880px;
  top: 38px;
  width: 60px;
  @include browsers(neptuneJump 2.55s -5.77s linear infinite);
}

.pluto {
  @extend .mercury;
  background-color: $pluto;
  box-shadow: inset -3px -3px $pluto - 15;
  height: 30px;
  left: 1000px;
  top: 55px;
  width: 30px;
  @include browsers(plutoJump 2.77s -1.22s linear infinite);
  &:before {
    background-color: $pluto-2;
    height: 8px;
    left: -1px;
    opacity: 0.8;
    top: 18px;
    width: 15px;
    @include transform(rotate(45deg));
  }
  &:after {
    background-color: $pluto-2;
    opacity: 0.8;
  }
}

/* planet animations */
@include animation(mercuryJump) {
  0% {
    top: 42.5px;
  }
  30% {
    top: 37.5px;
  }
  70% {
    top: 47.5px;
  }
  100% {
    top: 42.5px;
  }
}
@include animation(venusJump) {
  0% {
    top: 35px;
  }
  30% {
    top: 30px;
  }
  70% {
    top: 40px;
  }
  100% {
    top: 35px;
  }
}
@include animation(earthJump) {
  0% {
    top: 40px;
  }
  30% {
    top: 35px;
  }
  70% {
    top: 45px;
  }
  100% {
    top: 40px;
  }
}
@include animation(marsJump) {
  0% {
    top: 45px;
  }
  30% {
    top: 40px;
  }
  70% {
    top: 50px;
  }
  100% {
    top: 45px;
  }
}
@include animation(jupiterJump) {
  0% {
    top: 25px;
  }
  30% {
    top: 20px;
  }
  70% {
    top: 30px;
  }
  100% {
    top: 25px;
  }
}
@include animation(saturnJump) {
  0% {
    top: 35px;
  }
  30% {
    top: 30px;
  }
  70% {
    top: 40px;
  }
  100% {
    top: 35px;
  }
}
@include animation(uranusJump) {
  0% {
    top: 34px;
  }
  30% {
    top: 29px;
  }
  70% {
    top: 39px;
  }
  100% {
    top: 34px;
  }
}
@include animation(neptuneJump) {
  0% {
    top: 38px;
  }
  30% {
    top: 33px;
  }
  70% {
    top: 43px;
  }
  100% {
    top: 38px;
  }
}
@include animation(plutoJump) {
  0% {
    top: 55px;
  }
  30% {
    top: 50px;
  }
  70% {
    top: 60px;
  }
  100% {
    top: 55px;
  }
}
@include animation(sunshine) {
  0% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.55;
  }
  100% {
    opacity: 0.3;
  }
}

/* sky/universe background */
.stars{
  background-color: #f9f9f9;
  border-radius: 5px;
  display: inline-block;
  position: absolute;
}
@for $i from 1 through 75{
  .s#{$i}{
    $speed: random(15) + 10 + s;
    $delay: - (random(25)) + s;
    $size: random(1) + 0.5px;
    height: $size;
    left: random(100) + 0%;
    top: random(100) + 0%;
    width: $size;
    @include browsers(shiningStar $speed $delay infinite);
  }
}

/* animations */
@include animation(shiningStar) {
  0% { 
    opacity: 1; 
  }
  20% { 
    opacity: 0.5; 
  }
  40% {
    opacity: 0;
  }
  60% { 
    opacity: 0.5; 
  }
  80% {
    opacity: 0.75;
  }
  100% {
    opacity: 1;
  }
}
              
            
!

JS

              
                $(function(){
  /* creating stars */
  for (i = 0; i < 75; i++)
    $(".stars-wrapper").append("<div class='stars s" + i +"'></div>");  
  
});
              
            
!
999px

Console