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

              
                <!-- Inspired by this dribbble post by Colin Garvin https://dribbble.com/shots/1426764-Submit-Button -->
<div class="loading-dock">
    <svg id="load-b" x="0px" y="0px" viewBox="0 0 150 150">
    <circle class="loading-inner" cx="75" cy="75" r="60"/>
 </svg>
  <svg id="load" x="0px" y="0px" viewBox="0 0 150 150">
    <circle class="loading-inner" cx="75" cy="75" r="60"/>
 </svg>
 <button class="submit">Submit</button>
  <svg id="check" style="width:24px;height:24px" viewBox="0 0 24 24">
    <path fill="#FFFFFF" d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" />
</svg>
</div>

              
            
!

CSS

              
                // Credit to nau.val() for the original loading svg https://codepen.io/pedox/pen/PwQezw
@import url(https://fonts.googleapis.com/css?family=Roboto:400,300);

$turquoise: #58c996;
$dark-text: hsl(0, 0%, 13%);
$border-width: 2px;

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body{
  height: 100%;
  width: 100%; 
}

body {
  //background:$turquoise;
  font-family: 'Helvetica Neue', 'Roboto', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading-dock{
  background-color: white;
  width: 300px;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
}

button.submit{
  cursor: pointer;
  width: 160px;
  height: 50px;
  font-size: 17px;
  font-weight: 600;
  color: $turquoise;
  background-color: white;
  border-radius: 40px;
  border: $border-width solid $turquoise;
  transition: all .2s;
  letter-spacing: 1px;
  font-family: 'Helvetica Neue', sans-serif;
  &:hover{
    background: $turquoise;
    color: white;
  }
  &:active{
    transform: scale(0.95);
  }
  
  &:focus{
    outline: none;
    background: $turquoise;
    color: white;
  }
  
  &.popout{
    animation: circle-to-button .5s linear forwards;
  }
  &.return{
    animation: fade-to-original .3s linear;
    &:hover{
      background: $turquoise;
      color: white;
    }
  }
}

.loaded{
  button.submit{
    background-color: $turquoise;
    animation: button-to-circle .5s linear forwards;
    animation-delay: .3s;
  }
  #load{
    animation: loading-circle 3s linear forwards;
    animation-delay: 1s;
  }
}

#load, #load-b {
    display: none;
    position: absolute;
		width: 58px;
    height: 58px;
    opacity: 0;
    .loading-inner {
		  stroke: {
        dasharray: 900;
        // Thickness of line
        width: 8;
        miterlimit: 10;
        linecap: round;
      }
      stroke: #c3c3c3;
      fill: transparent;
    }
	}
#load-b{
  opacity: 0;
  .loading-inner{
    stroke: $turquoise;
  }
}

svg{
  position: absolute;
  display: none
}

@keyframes loading-circle {
		0% { 
      opacity: 1;
      stroke-dashoffset: 0
    }
  50%{
          opacity: 1;
      stroke-dashoffset: -100
  }
		100% { 
      opacity: 1;
      stroke-dashoffset: -600;
    }
}

@keyframes button-to-circle{
  0%{
    width: 160px;
    color: $turquoise;
    border-color: $turquoise;
    background-color: $turquoise;
  }
  50%{
    color: rgba(255, 255, 255, 0);
  }
  90%{
    width: 50px;
    color: rgba(255, 255, 255, 0);
    border-color: #c3c3c3;
  }
  100%{
    width: 50px;
    border-color: rgba(255, 255, 255, 0);
    color: rgba(255, 255, 255, 0);
    background-color:  rgba(255, 255, 255, 0);
  }
}

@keyframes circle-to-button{
  0%{
    border-color: $turquoise;
    background-color: $turquoise;
    height: 50px;
    width: 50px;
  }
  50%{
    height: 50px;
    width: 50px;
  }
  100%{
    height: 50px;
    width: 160px;
    border-color: $turquoise;
    background-color: $turquoise;
  }
}

@keyframes fade-to-original{
  0%{
    background-color: $turquoise;
  }
  100%{
    background-color: white;
  }
}
              
            
!

JS

              
                var clicked = false;
var submit = document.querySelector('.submit');
submit.addEventListener("click", function(){
  // Make sure user cannot click button again until it has been reset
  if( !clicked ){
    clicked = true;
    submit.classList.remove("return");
    submit.blur();
    document.querySelector('.loading-dock').classList.add('loaded');
    document.getElementById('load').style.display= 'initial';
    document.getElementById('load-b').style.display= 'initial';
    setTimeout(function(){
      document.getElementById('load').style.opacity = 1;
    }, 750);
    setTimeout(function(){
      document.getElementById('load-b').style.opacity = 1;
    }, 900);
    setTimeout(function(){
      document.querySelector('.loading-dock').classList.remove('loaded');
      document.getElementById('load').style.display = 'none';
      document.getElementById('load-b').style.display = 'none';
      document.getElementById('load').style.opacity = 0;
      document.getElementById('load-b').style.opacity = 0;
      let submit = document.querySelector('.submit');
      submit.classList.add("popout");
      submit.innerHTML = "";
      setTimeout(function(){
      document.getElementById('check').style.display = "block";
      }, 300);
    }, 3600);

    //reset all
    setTimeout(function(){
      submit.classList.remove("popout");
      submit.classList.add("return");
      submit.innerHTML = "Submit";
      document.getElementById('check').style.display = "none";
      clicked = false;
    }, 5300);
  }
})
              
            
!
999px

Console