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

              
                <!-- SVG templates -->
<!-- Would have used <use> but it's tricky to style and trasition Shadow DOM elements -->

<svg class="svg--template loader">
  <circle class="circle1" stroke="none" stroke-width="4" fill="none" r="25" cx="25" cy="25"/>
</svg>
<svg class="svg--template checkmark" viewBox="0 0 50 50">
  <g class="checkmark1">
    <path class="line1" d="M20.8,36l-4,4c-0.7,0.7-1.7,0.7-2.4,0L0.8,26.4c-0.7-0.7-0.7-1.7,0-2.4l4-4c0.7-0.7,1.7-0.7,2.4,0l13.6,13.6
    C21.5,34.3,21.5,35.4,20.8,36z"/>
  <path class="line2" d="M14.5,39.9l-4-4c-0.7-0.7-0.7-1.7,0-2.4L43.4,0.6c0.7-0.7,1.7-0.7,2.4,0l4,4c0.7,0.7,0.7,1.7,0,2.4L16.9,39.9
    C16.3,40.6,15.2,40.6,14.5,39.9z"/>
  </g>
</svg>

<svg class="svg--template" viewBox="0 0 304 305" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg">
  <symbol id="shadow--logo-dribbble">
		<path id="SVGID_1_" d="M152,298.2C73,298.2,8.7,234,8.7,155.1C8.7,76.2,73,12,152,12c79,0,143.3,64.2,143.3,143.1
			C295.3,234,231,298.2,152,298.2L152,298.2z M272.8,174.7c-4.2-1.3-37.9-11.4-76.2-5.2c16,43.9,22.5,79.7,23.8,87.1
			C247.8,238.1,267.4,208.7,272.8,174.7L272.8,174.7z M199.8,267.8c-1.8-10.7-8.9-48.1-26.1-92.7c-0.3,0.1-0.5,0.2-0.8,0.3
			c-69,24-93.8,71.8-96,76.3c20.8,16.2,46.8,25.8,75.1,25.8C168.9,277.5,185.1,274.1,199.8,267.8L199.8,267.8z M61.1,237
			c2.8-4.7,36.4-60.3,99.5-80.7c1.6-0.5,3.2-1,4.8-1.5c-3.1-6.9-6.4-13.9-9.9-20.7C94.3,152.4,35,151.7,29.7,151.6
			c0,1.2-0.1,2.5-0.1,3.7C29.6,186.7,41.5,215.4,61.1,237L61.1,237z M32.2,130.3c5.5,0.1,55.9,0.3,113.1-14.9
			c-20.3-36-42.1-66.3-45.4-70.7C65.7,60.8,40.1,92.3,32.2,130.3L32.2,130.3z M123.3,36.5c3.4,4.5,25.6,34.8,45.7,71.5
			c43.5-16.3,61.9-41,64.1-44.1c-21.6-19.1-50-30.8-81.1-30.8C142.1,33.1,132.5,34.3,123.3,36.5L123.3,36.5z M246.7,78
			c-2.6,3.5-23.1,29.7-68.3,48.2c2.8,5.8,5.6,11.7,8.1,17.7c0.9,2.1,1.8,4.2,2.6,6.3c40.7-5.1,81.2,3.1,85.2,3.9
			C274.1,125.3,263.8,98.8,246.7,78L246.7,78z"/>
  </symbol>
</svg>

<div class="side-note"><span>A pen by</span><a href='https://codepen.io/guywald/' target='_blank'>Guy Waldman</a></div>

<div id="browserAlert" style="display: none"><span></span></div>

<!-- --------------------------------------------------------------------------- -->

<header>
  <svg id="logo-dribbble" viewBox="0 0 304 305" width="150" height="150">
   <use xlink:href="#shadow--logo-dribbble"></use>
</svg>
  <div class="header--text"><span>Inspired by: </span><a href="https://dribbble.com/shots/1426764-Submit-Button" target="_blank">Colin Garven</a></div>
</header>

<main>
  <!-- button -->
  <button class="btnSubmit">Submit</button>
</main>
              
            
!

CSS

              
                // WEB FONT --------------------------------------------------------------

@import 'https://fonts.googleapis.com/css?family=Roboto:300,500,700'

// VARIABLES (customize if you want) ------------------------------------

$bgColor: #fafafa
$shadow: rgba(lighten($bgColor, 10%),.2)
$accentColor: #1ECD97
$secondaryColor: #C5C5C5
$btnWidth: 175px
$btnHeight: 50px // Firefox users - don't touch!
$borderRadius: 35px
$btnBorder: 2px
$loaderStroke: 3px
$dribbble: #ea4c89

// MAIN STYLES ---------------------------------------------------------

// body & header --------------------------------------------------------

body
  display: flex
  align-items: center
  justify-content: center
  flex-direction: column
  height: 100vh
  widht: 100vw
  overflow: hidden
  background: $bgColor
  font-family: 'Roboto', sans-serif
  font-weight: 400
  font-size: 14px
  font-smooth: auto
  -webkit-font-smoothing: antialiased
  
header
  position: absolute
  top: 30px
  width: calc(30px + 15em)
  left: calc(50% - 15px - 7.5em)
  display: flex
  flex-flow: row nowrap
  align-items: center
  justify-content: space-around
  margin-bottom: 1em
  font-size: .8em
  .header--text
    letter-spacing: 1px
    span
      color: #777
      font-weight: 300
      margin-bottom: 0
    a
      display: inline-block
      margin-top: 0
      text-decoration: none
      font-weight: 700
      color: $dribbble
      transition: color 300ms ease
      &:hover
        color: lighten($dribbble, 10%)
  #logo-dribbble
    width: 2em
    height: auto
    fill: $dribbble
    transition: fill 300ms ease
    &:hover
      fill: lighten($dribbble, 10%)
    
// button ----------------------------------------------------------
  
button.btnSubmit
  
  // reset
  outline: none
  border: none
  cursor: default
  transition: box-shadow 300ms ease
  letter-spacing: 2px
  box-shadow: 0px 0px $btnHeight/2 10px $shadow
  user-select: none
  
  position: relative
  box-sizing: border-box
  width: $btnWidth
  height: $btnHeight
  border-radius: $borderRadius
  border: $btnBorder solid
  border-color: $accentColor
  background: none
  color: $accentColor
  transition: all 300ms ease-out
  &:hover
    cursor: pointer
    font-size: 1.05em
    border-color: transparent
    background: $accentColor
    color: $bgColor
  &.clicked
    pointer-events: none
    animation: anim1 200ms cubic-bezier(0.2, 0, 0.8, 1), anim2 300ms cubic-bezier(0.6, 0, 0.7, 1) 300ms 1 forwards
    &.done
      display: flex
      justify-content: center
      align-items: center
      width: $btnHeight
      background: $accentColor // fallback
      background: linear-gradient(0, $accentColor, lighten($accentColor, 5%))
      border-width: 0
      border-color: rgba($accentColor, 0)
      color: rgba($accentColor, 0)
      transition: all 1000ms ease
      animation: anim4 300ms cubic-bezier(0.2, 0, 0.4, 1) forwards

// svg -------------------------------------------------------------

svg.svg--template
  display: none

svg.loader
  position: absolute
  width: $btnHeight
  height: $btnHeight
  overflow: visible
  
svg
  &.loader
    position: absolute
    left: -($btnBorder)
    top: -($btnBorder)
    width: $btnHeight
    height: $btnHeight
  &.checkmark
    height: 1.2em
    width: 100%
  .circle1
    stroke: $accentColor
    stroke-width: $loaderStroke
    r: ($btnHeight - $loaderStroke)/2
    cx: ($btnHeight)/2
    cy: ($btnHeight)/2
    width: 100%
    height: 100%
    stroke-dasharray: $btnHeight*3.14
    transform: rotate(-90deg)
    transform-origin: 50% 50%
    animation: animLoading 2500ms cubic-bezier(0.6, 0, 0, 1)
  .checkmark1
    fill: $bgColor
    .line1
      transform-origin: 100% 100%
    .line2
      transform-origin: 0% 100%
    .line1, .line2
      animation: growAndRotate 500ms cubic-bezier(0.4, 0, 0, 1)
  
    
// animations ------------------------------------------------------------


@keyframes anim1
  0%
    font-size: 1.05em
  50%
    font-size: 0.9em
  100%
    font-size: 1.05emj

@keyframes anim2
  40%
    border-radius: $borderRadius
  20%, 100%
    color: rgba($accentColor, 0)
  100%
    background: none
    border-width: $btnBorder
    border-color: $secondaryColor
    border-radius: 50%
    padding: 0
    width: $btnHeight

@keyframes animLoading
  0%
    stroke-dashoffset: $btnHeight*3.14
  100%
    stroke-dashoffset: 0

@keyframes anim4
  0%
    border-radius: 50%
    width: $btnHeight
  40%
    border-radius: $borderRadius
  100%
    width: $btnWidth
  
@keyframes growAndRotate
  0%
    opacity: 0
    transform: scale(.4) rotate(-5deg)
  30%, 100%
    opacity: 1
  100%
    transform: scale(1) rotate(0)
  
// browser alert -------------------------------------------------
// (shows if user is on Edge/IE)

#browserAlert
  z-index: 10
  display: none
  left: 0
  top: 0
  position: absolute
  width: 100vw
  height: 100vh
  background: rgba(white, .8)
  pointer-events: none
  font-size: 2em
  &.active
    display: block
    span
      position: absolute
      left: 50%
      top: 50%
      transform: translate(-50%, -50%)
    
  
// side note -----------------------------------------------------

.side-note
  padding-top: 1em
  position: absolute
  display: flex
  justify-content: flex-start
  align-items: center
  flex-direction: column
  height: 10em
  min-width: 20em
  border-top: 2px solid darken($bgColor, 30%)
  background: white
  z-index: 10
  transform: rotate(-45deg)
  transform-origin: 100% 100%
  right: -8.5em
  bottom: 5em
  font-weight: 300
  font-size: .7em
  color: darken($bgColor, 30%)
  a
    color: darken($bgColor, 50%)
    margin-top: .3em
    cursor: default
    text-decoration: underline
    color: inherit
    font-weight: 500
    transition: color 300ms ease
    &:hover
      color: darken($bgColor, 60%)
              
            
!

JS

              
                /*
TESTED SUCCESFFULY ON: Chrome 52 / Firefox 48
DON'T VIEW ON: Edge
*/

$(function() {
  
  // check if browser is not supported
  var $browserAlert = $('#browserAlert');
  $browserAlert.hide();

  $.ajax({
    url: 'https://cdn.rawgit.com/arasatasaygin/is.js/master/is.min.js',
    dataType: "script",
    success: function() {

      if (is.edge() || is.ie()) {
        $browserAlert.find('span').text('View on Chrome/Firefox.');
        $browserAlert.show();
        $browserAlert.addClass('active');
      }

    }
  });

  var $btn = $("button.btnSubmit");
  var $loaderTemplate = $("svg.loader");
  var $checkmarkTemplate = $("svg.checkmark");

  $btn.on('click', function() {
    if ($(this).hasClass('clicked')) return;
    $(this).addClass('clicked');
    var self = $(this);
    var timeout1 = 600,
      timeout2 = 2500,
      timeout3 = 3000;
    setTimeout(function() {

      self.append($loaderTemplate.clone());
      self.find('svg').removeClass('svg--template');
      self.find('svg').css('display', 'initial');
    }, timeout1);
    setTimeout(function() {
      self.text('');
      self.find('svg').remove();
      self.append($checkmarkTemplate.clone());
      self.find('svg').css('display', 'initial');
      self.find('svg').removeClass('svg--template');
      self.addClass('done');
    }, timeout1 + timeout2);
    setTimeout(function() {
      self.find('svg').remove();
      self.text('Submit');
      self.removeClass('clicked');
      self.removeClass('done');
    }, timeout1 + timeout2 + timeout3);
  });

});
              
            
!
999px

Console