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

              
                <section class="container">
  <div class="container-inner">
    <form action="" class="sign-up">
      <label class="sign-up__label" for="email">Your email</label>
      <input type="email" class="sign-up__input-box" id="email" placeholder="youremail@example.com" required>
      <button class="sign-up__btn">Sign Me Up!</button>
    </form>
    <div class="sign-up__loader" aria-label="loading"> 
    </div>
    <div class="sign-up__success" aria-label="success">
      <span class="sign-up__success-icon">✔</span> 
    </div>
  </div>
</section>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

*::before,
*::after {
  box-sizing: inherit;
}

html, body {
  width: 100%;
  height: 100%;
  background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/234228/about-bg.jpg') no-repeat center center;
  background-size: cover;
}

html {
  font-size: 100%;
  line-height: 1.5;
}

.container {
  width: 100%;
  height: 100%;
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
}

.container-inner {
  position: relative;
  width: 100%;
  height: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  background-color: rgba(161, 66, 244, .8);
}

.sign-up {
  display: block;
  border: 1px solid #2a034c;
  padding: 1em;
}

.sign-up__label {
  color: white;
  font-size:1.625rem;
  letter-spacing: 1px;
}

.sign-up__input-box {
  padding: 10px;
  margin-right: 5px;
  margin-bottom: 1.5em;
  font-size: 1.5em;
  color: #444;
}

.sign-up__input-box:focus {
  border: 2px solid #2d055e;
}

.sign-up__btn {
  padding: 1em;
  margin: 0 auto 0.6em;
  outline: 0;
  text-transform: uppercase;
  font-weight: bold;
  text-align: center;
  vertical-align: middle;
  letter-spacing: 1px;
  color: #842def;
  background-color: #e0dc06;
  border-color: #9b9906;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.5s,
              color 0.5s,
              background-color 0.5s;
}

.sign-up__btn:focus,
.sign-up__btn:hover {
  color: #fff;
  border-color: #3f3e01;
  background-color: #827f02;
}

.sign-up__success {
  position: absolute;
  left: calc(50% - 50px);
  top: calc(50% - 50px);
  margin: auto;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background-color: #e0dc06;
  text-align: center;
  color: green;
  font-size: 50px;
  font-weight: bold;
  line-height: 100px;
  display: none;
}

.sign-up__loader {
  position: absolute;
  left: calc(50% - 60px);
  top: calc(50% - 60px);
  margin: auto;
  border: 16px solid #ae8ace; /* light purple */
  border-top: 16px solid #e0dc06; /* yellow */
  border-radius: 50%;
  width: 120px;
  height: 120px;
  animation: rotate 2s linear infinite;
  display: none;
}

/* Loader animation */
@keyframes rotate {
  100% { transform: rotate(360deg); }
}



              
            
!

JS

              
                //Hides loader after success icon appears
const hideLoader = (loaderEl) => {
  Velocity(loaderEl, 'transition.fadeOut', 1000);
};

//hides form after successful submission
const hideForm = (formEl, iconEl, loaderEl) => {
  Velocity(formEl,'transition.bounceUpOut', 500);
  Velocity(loaderEl, 'transition.fadeIn');
  //Simulate the time it takes to process the form
  const timer = setTimeout( () => {
   Velocity(iconEl, 'transition.bounceDownIn', 500);
  }, 2000);
  hideLoader(loaderEl);
};

//Caching reference to elements
const signButton = document.querySelector('.sign-up__btn'),
      signForm = document.querySelector('.sign-up'),
      success = document.querySelector('.sign-up__success'),
      loader = document.querySelector('.sign-up__loader');

//Handler for sign up button
signButton.addEventListener('click', (e) => {
  e.preventDefault();
  hideForm(signForm, success, loader); 
});
              
            
!
999px

Console