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
  - for(i=0; i < 8; i++)
    .side
              
            
!

CSS

              
                body
  font-family: "Lato"
  background: #EFECCA
  color: #1d1d1d
  margin: 0
  padding: 0

$side-length = 20px
$side-width = 6px
$side-color = #046380
$loader-size = $side-length * (1 + math(2, 'sqrt'))

$anim-duration = 1.5s
$anim-offset = 0

.loader
  position: absolute
  left: 50%
  top: 50%
  width: $loader-size
  height: $loader-size
  margin-left: ($loader-size / -2)
  margin-top: ($loader-size / -2)
  border-radius: 100%
  animation-name: loader
  animation-iteration-count: infinite
  animation-timing-function: linear
  animation-duration: 4s

  .side
    display: block
    width: $side-width
    height: $side-length
    background-color: $side-color
    margin: 2px
    position: absolute
    border-radius: 50%
    animation-duration: $anim-duration
    animation-iteration-count: infinite
    animation-timing-function: ease

    // &:before, &:after
    //   content: ""
    //   position: absolute
    //   border-style: solid
    // &:before
    //   top: ($side-width * -1)
    //   border-width: 0 0 $side-width $side-width
    //   border-color: transparent transparent $side-color transparent
    // &:after
    //   top: $side-length
    //   border-width: 0 $side-width $side-width 0
    //   border-color: transparent $side-color transparent transparent

    &:nth-child(1), &:nth-child(5)
      transform: rotate(0deg)
      animation-name: rotate0
    &:nth-child(3), &:nth-child(7)
      transform: rotate(90deg)
      animation-name: rotate90
    &:nth-child(2), &:nth-child(6)
      transform: rotate(45deg)
      animation-name: rotate45
    &:nth-child(4), &:nth-child(8)
      transform: rotate(135deg)
      animation-name: rotate135

  for count in (0..7)
    .side:nth-child({count + 1})
      $side-offset = ($side-width / 2) * count
      $dotval = ($loader-size / 2)

      top: sin(45deg * count) * $dotval + $dotval
      left: cos(45deg * count) * $dotval + $dotval
      margin-left: ($side-width / -2)
      margin-top: ($side-length / -2)
      animation-delay: $anim-offset * count

// side keyframes
@keyframes rotate0
  0%
    transform: rotate(0deg)
  60%
    transform: rotate(180deg)
  100%
    transform: rotate(180deg)

@keyframes rotate90
  0%
    transform: rotate(90deg)
  60%
    transform: rotate(270deg)
  100%
    transform: rotate(270deg)

@keyframes rotate45
  0%
    transform: rotate(45deg)
  60%
    transform: rotate(225deg)
  100%
    transform: rotate(225deg)

@keyframes rotate135
  0%
    transform: rotate(135deg)
  60%
    transform: rotate(315deg)
  100%
    transform: rotate(315deg)

// loader keyframe
@keyframes loader
  0%
    transform: rotate(0deg)
  100%
    transform: rotate(360deg)

              
            
!

JS

              
                
              
            
!
999px

Console