css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              #sun
  #mercury
  #venus
  #earth
  #mars
  #jupiter
  #saturn
  #uranus
  #neptune

#pluto-foreveralone
            
          
!
            
              @import compass

// Adjustments
$scale-factor: 1
$radii-factor: 1
$distance-factor: 1
$time-factor: 1

// From codepen.io/rileyjshaw/pen/JDILk
@function scale-list($list, $factor)
  $first-item: nth($list, 1)
  $blank: $first-item * $factor
  @each $i in reject($list, $first-item)
    $blank: append($blank, $i*$factor)
  @return $blank

// Variables; lists in order of distance from sun
$planets: sun mercury venus earth mars jupiter saturn uranus neptune
$radii: 60px 7px 18px 19px 10px 214px 180px 76px 74px
$distances: 0 190px 360px 500px 760px 2590px 4750px 9540px 15000px
$periods: 0 8.8s 22.5s 36.5s 68.7s 433.2s 1076s 3070s 6020s 9060s
$light-colors: #e84b1e #2ecc71 #e67e22 #80ccec #dc573a #e74c3c #ede8b3 #22afd2 #3498db
$dark-colors: #be4128 #27ae60 #d35400 #21b770 #b24e3b #c0392b #f7dca8 #24758c #2980b9
$black: #281e21

$radii: scale-list($radii, $scale-factor*$radii-factor)
$distances: scale-list($distances, $scale-factor*$distance-factor)
$periods: scale-list($periods, $time-factor)

$noise: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAABOFBMVEWDg4NycnJnZ2ebm5tjY2OgoKCurq5lZWWoqKiKiopmZmahoaGOjo5TU1N6enp7e3uRkZGJiYmFhYWxsbFOTk6Xl5eBgYGkpKRhYWFRUVGvr69dXV2wsLBiYmKnp6dUVFR5eXmdnZ1sbGxYWFh2dnZ0dHSmpqaZmZlVVVVqamqsrKyCgoJ3d3dubm5fX19tbW2ioqKSkpJWVlaHh4epqalSUlKTk5OVlZWysrJoaGhzc3N+fn5wcHBaWlqcnJxkZGRpaWlvb2+zs7NcXFxPT09/f3+lpaWWlpaQkJCjo6OIiIitra2enp6YmJhQUFBZWVmqqqqLi4uNjY1eXl6rq6ufn599fX2AgIB8fHyEhIRxcXFra2tbW1uPj4+MjIyGhoaamppgYGB4eHhNTU1XV1d1dXW0tLSUlJSHWuNDAAAAaHRSTlMaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGsgZs4IAAAaZSURBVHhelZWFrmZVDEb3cffzq7u7u7u7u9z7/m8AhISQwMDMAzRN2/WtAhO7zOd0x0U/UNb0oWQZGLWhIHBK/lC96klgkA+3B5JoqI9ozRcn4306YeDweKG9vxo5YbGbqBkln93ZFGs3SA0RRpSO4dpdpg+VnMUv8BEqmiIcli8gJeRZc29K51qOg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HS2d8pSqoZdCBAv6mdJ72revxET6giWB7PgbJph+2i011uUifL7xruTb3zv+NKvgpqRSU0yBSckeKeQzSgeZZcaQb8+JYzehtPraBkg3Jc3e8boxVXJzNW23deFoZ74Vzy6xd1+FemwZ/neOnHQh2ufopy5c/r69Cz+scIrx+uN+dzhyzEjCeNLL0hgjGUOHdvb25YDijfq/An/D+iv7BBDutUsyuvBrH2ya6j2SIkLvjxFIpk8H37wcAt9KHX9cLeNmn+8CR1xtKgrzojVXl/qikMqAsDcO1coQrEanpsrB3DlAImIwS07oN2k3C2x2jSE3jxSm908P1tUXUMD15Lpp50CHii7i2BDSdYMcfB7+X7QdqymsDWH6BJ5APN+qIRhTVc/msYf5CjOyA82VSuIEtZA3GmUuXBK2r6xJ2LXO8fCU9kmCvydDptoECLq+XXLs4w8U+DUZyir9Cw+XL3rHFGoDNI9Rw3baFy/fZwTY2Gr0WMuLaxMrWaC5rh+IeyZijp0fdaDLPg8YtugLgnwYZss1xIh1o13qB7L8pC6wEutNQVuy5aIpNkSSl2yWAiRADUVXSMqpTH8Da3gCNr8maodNIxjY7CXyvzHHfiJoto/CE9UMmX+cRqPC8RKdks7OV35txMGkdXzOkkhX9wTr+tIOGKZzjoo+qbWy3hsJJtz5D7nP+syyjxYe7eCAMIOywwFNfv/ZMNyBSxV0g7ZEJCPVE8IA5sw7jg9Kx3RXdfCQXGxpH+0kyHYpBj0H4y2VdAHRW9RyegOPPB+5NudysJji/lnxHQ9pFOMLMLeZ0O9hrnsuFsstbjczbC+14JHS+xsDf3pPgQXvUG6Q/H2fKV/B7jYX8RdOrug5BjG/1jueAPq1ElQb4AeH/sRNwnNyoFqsJwT9tWhChzL/IP/gxfleLSIgVQDdRvKBZVfu9wgKkeHEEfgIqa/F6fJ0HM8knJtkbCn4hKFvNDLWXDr8BGMywGD1Lh54AAAAASUVORK5CYII=")

=planet($radius, $fg, $bg)
  height: 2 * $radius
  width: 2 * $radius
  margin: -$radius
  background: $fg $noise
  +border-radius(50%)
  @if $radius != nth($radii, 1)
    +box-shadow(-$radius/3 #{-$radius/3} $radius/2 rgba($bg, .8) inset, $radius/2 $radius/2 rgba($black, .2))
  @else
    +box-shadow(-$radius/3 #{-$radius/3} $radius/3 rgba($bg, .8) inset)
  
html
  background: $black
  height: 100%
  width: 100%
  overflow: hidden

#sun
  left: 50%
  background-size: 250px
  -webkit-animation: spin 6s linear infinite
  animation: spin 6s linear infinite

  &:before
    content: 'Subtle planet rotation'
    top: -84px
  &:after
    content: 'Using a noisy data-uri'
    bottom: -84px
  &:before, &:after
    position: absolute
    left: -600px / 2 + nth($radii, 1)
    width: 600px
    font: 24px 'Limelight', sans-serif
    text-align: center
    color: rgba(#efd2ba, .3)

div
  content: ''
  position: absolute
  top: 50%
  
@for $i from 1 through length($planets)
  $p: nth($planets, $i)
  $r: nth($radii, $i)
  $d: nth($distances, $i)
  $t: nth($periods, $i)
  $cl: nth($light-colors, $i)
  $cd: nth($dark-colors, $i)
    
  ##{$p}
    -webkit-animation: orbit-#{$p} $t ease-in-out infinite, spin 6s linear infinite
    animation: orbit-#{$p} $t ease-in-out infinite, spin 6s linear infinite
    +planet($r, $cl, $cd)

  @-webkit-keyframes orbit-#{$p}
    0%
      z-index: pow(10, $i)
      left: -$d
    25%
      height: $r * 3
      width: $r * 3
    50%
      z-index: 0
      left: 120px + $d
    75%
      height: $r
      width: $r
    99.9%
      z-index: -#{pow(10, $i)}
      left: -$d
    100%
      z-index: pow(10, $i)
      left: -$d
    
  @keyframes orbit-#{$p}
    0%
      z-index: pow(10, $i)
      left: -$d
    25%
      height: $r * 3
      width: $r * 3
    50%
      z-index: 0
      left: 120px + $d
    75%
      height: $r
      width: $r
    99.9%
      z-index: -#{pow(10, $i)}
      left: -$d
    100%
      z-index: pow(10, $i)
      left: -$d
      
@-webkit-keyframes spin
  from
    background-position-x: 0px
  to
    background-position-x: 250px
    
@keyframes spin
  from
    background-position-x: 0px
  to
    background-position-x: 250px
    
#pluto-foreveralone
  position: absolute
  top: auto
  bottom: 6px
  right: 6px
  height: 4px
  width: 4px
  background: #7faad7
  +border-radius(2px)
  
  &:before
    content: 'whatever, screw you guys..'
    position: relative
    top: -36px
    left: -134px
    display: block
    width: 150px
    height: 26px
    font: 10px/26px sans-serif
    text-align: center
    color: scale-lightness($black, -10%)
    background: scale-lightness($black, 10%)
    +border-radius(4px)
    
  &:after 
    content: ''
    position: absolute
    border-style: solid
    border-width: 5px 5px 0
    border-color: scale-lightness($black, 10%) transparent
    display: block
    width: 0
    z-index: 1
    top: -10px
    left: -4px

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console