cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Simple CSS Loaders

A Pen By Captain Anonymous

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <h1>Simple CSS Loaders</h1>

<div class="buttons">
  <span>Toggle:</span>
  <button data-type="color">Color</button>
  <button data-type="shadow">Shadow</button>
</div>

<h2>Fade</h2>
<div class="loader" id="fade">
  <div></div>
  <div></div>
  <div></div>
</div>

<h2>Lift</h2>
<div class="loader" id="lift">
  <div></div>
  <div></div>
  <div></div>
</div>
  
<h2>Lift + Fade</h2>
<div class="loader" id="lift-fade">
  <div></div>
  <div></div>
  <div></div>
</div>

<h2>Scale</h2>
<div class="loader" id="scale">
  <div></div>
  <div></div>
  <div></div>
</div>

<h2>Scale + Fade</h2>
<div class="loader" id="scale-fade">
  <div></div>
  <div></div>
  <div></div>
</div>

<h2>Rectangle Stretch</h2>
<div class="loader loader-2" id="rect-stretch">
  <div></div>
  <div></div>
  <div></div>
</div>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Nunito:300,400,700');

$gray: #8ba0b0;
$colors: #9782fe, #8fb9ff, #61dcd8;

@mixin floating ($color,
$height) {
  $shadow: transparentize($color, 0.8);
  $settings: null;
  @if ($height=='low') {
    $settings: 0 2px 4px 0 rgba(0, 0, 0, 0.05), 0 10px 20px -4px;
  }
  @if ($height=='high') {
    $settings: 0 4px 8px -1px rgba(0, 0, 0, 0.1), 0 15px 30px -6px;
  }
  box-shadow: $settings $shadow;
}

@mixin shadow ($color) {
  $shadow: transparentize($color, 0.2);
  box-shadow: 0 5px 15px -2px $shadow;
}

body {
  background: #edf2fa;
  background: linear-gradient(to right, #fff, #e5ecff);
  font-family: 'Nunito', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  text-align: center;
  color: $gray;
  padding: 4rem 0;
}

h1 {
  font-weight: 400;
  color: #9b5ef7;
  background: -webkit-linear-gradient(#714eff, #c0ceff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-weight: 300;
  margin-top: 2rem;
}

.buttons span {
  margin-right: 0.5rem;
}

button {
  font-family: inherit;
  background-color: transparent;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid lighten(#714eff, 10);
  font-weight: 700;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  color: #714eff;
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
  outline: 0;
  &:hover {
    background-color: lighten(#714eff, 30);
    @include floating(#9887ff,
    'high');
  }
  &:focus {
    background-color: lighten(#714eff, 32);
  }
  &.active {
    background-color: #714eff;
    border-color: #714eff;
    color: white;
    @include floating(#714eff,
    'high');
  }
}

.loader {
  display: flex;
  justify-content: center;
  div {
    width: 12px;
    height: 12px;
    background-color: $gray;
    border-radius: 50%;
    margin: 0 4px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
  }
  &.color {
    div:first-child {
      background-color: nth($colors, 1);
    }
    div:nth-child(2) {
      background-color: nth($colors, 2);
    }
    div:nth-child(3) {
      background-color: nth($colors, 3);
    }
  }
  &.shadow {
    &.color {
      div:first-child {
        @include shadow(nth($colors, 1));
      }
      div:nth-child(2) {
        @include shadow(nth($colors, 2));
      }
      div:nth-child(3) {
        @include shadow(nth($colors, 3));
      }
    }
    div {
      box-shadow: 0 5px 15px -2px transparentize($gray, 0.1);
    }
  }
}

.loader-2 div {
  border-radius: 2px;
  height: 24px;
}

@keyframes fade {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

#fade {
  div {
    animation: fade 1s ease infinite;
    &:nth-child(2) {
      animation-delay: 0.15s;
    }
    &:nth-child(3) {
      animation-delay: 0.3s;
    }
  }
}

@keyframes lift {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
  100% {
    transform: translateY(0);
  }
}

#lift {
  div {
    animation: lift 1s ease infinite;
    &:nth-child(2) {
      animation-delay: 0.15s;
    }
    &:nth-child(3) {
      animation-delay: 0.3s;
    }
  }
}

@keyframes lift-fade {
  0% {
    opacity: 0;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px);
  }
  100% {
    opacity: 0;
    transform: translateY(0);
  }
}

#lift-fade {
  div {
    animation: lift-fade 1s ease infinite;
    &:nth-child(2) {
      animation-delay: 0.15s;
    }
    &:nth-child(3) {
      animation-delay: 0.3s;
    }
  }
}

@keyframes scale {
  0% {
    transform: scale(0.2);
  }
  50% {
    transform: scale(1);
  }
  100% {
    transform: scale(0.2);
  }
}

#scale {
  div {
    animation: scale 1s ease infinite;
    &:nth-child(2) {
      animation-delay: 0.15s;
    }
    &:nth-child(3) {
      animation-delay: 0.3s;
    }
  }
}

@keyframes scale-fade {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.4);
  }
}

#scale-fade {
  div {
    animation: scale-fade 1s ease infinite;
    &:nth-child(2) {
      animation-delay: 0.15s;
    }
    &:nth-child(3) {
      animation-delay: 0.3s;
    }
  }
}

@keyframes rect-stretch {
  0% {
    transform: scaleY(0.4);
  }
  50% {
    transform: scaleY(1);
  }
  100% {
    transform: scaleY(0.4);
  }
}

#rect-stretch {
  div {
    animation: rect-stretch 1s ease infinite;
    &:nth-child(2) {
      animation-delay: 0.15s;
    }
    &:nth-child(3) {
      animation-delay: 0.3s;
    }
  }
}
            
          
!
            
              $('button').on('click', function() {
  $(this).toggleClass('active')
  $('.loader').toggleClass($(this).data('type'))
})
            
          
!
999px
Loading ..................

Console