Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                .loader(style=`--bg: hsl(${Math.random() * 360}, 100%, 85%)`)
  - let i = 0
  while i < 8
    .dot(style=`--index: ${i}`)
    - i++
              
            
!

CSS

              
                *
  box-sizing border-box

body
  align-items center
  background-color #111
  display flex
  justify-content center
  min-height 100vh
  overflow-x hidden

:root
  --dot-size 5
  --speed 1.5
  --radius 10
  --center-size 5
  --rotation -25
  --ring-radius 8
  --ring-thickness .75
  --bg hsl(10, 100%, 85%)

.loader
  position relative
  height calc(var(--dot-size) * var(--center-size) * 1px)
  width calc(var(--dot-size) * var(--center-size) * 1px)
  animation turn calc(var(--speed) * 20s) calc(var(--speed) * -2s) infinite linear
  &:before
    content ''
    position absolute
    top 50%
    left 50%
    background var(--bg)
    height 100%
    width 100%
    transform translate(-50%, -50%)
    border-radius 100%
    animation pulse calc(var(--speed) * 1s) infinite alternate-reverse

.dot
  height calc(var(--dot-size) * 1px)
  width calc(var(--dot-size) * 1px)
  position absolute
  top 50%
  left 50%
  transform translate(-50%, -50%) rotate(calc((360 / 8) * var(--index) * 1deg)) translate(0, calc(var(--dot-size) * var(--radius) * 1px))

  &:after
  &:before
    content ''
    border-radius 100%
    box-sizing border-box
    position absolute
    background none
    top 50%
    left 50%
    animation-duration calc(var(--speed) * 1s)
    animation-delay calc((8 - var(--index)) * (var(--speed) / 8) * -1s)
    animation-iteration-count infinite
    animation-timing-function ease-in-out
    animation-fill-mode both
    transform translate(-50%, -50%) scale(var(--scale))

  &:after
    --dot-size 5
    --ring-thickness .75
    --ring-radius 8
    --scale 0
    animation-name load
    border calc(var(--dot-size) * var(--ring-thickness) * 1px) solid var(--bg)
    height calc(var(--dot-size) * var(--ring-radius) * 1px)
    width calc(var(--dot-size) * var(--ring-radius) * 1px)

  &:before
    --scale 1
    animation-name fade
    background var(--bg)
    height 100%
    width 100%

@keyframes fade
  0%
    opacity 1
  85%, 100%
    opacity .2

@keyframes load
  0%
    transform translate(-50%, -50%) scale(0)
  85%, 100%
    transform translate(-50%, -50%) scale(1)
    opacity 0

@keyframes pulse
  to
    opacity 0.35

@keyframes turn
  to
    transform rotate(-360deg)
              
            
!

JS

              
                // 404
              
            
!
999px

Console