Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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

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.

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">注册!</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;
  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;
  outline: none;
}

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

.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');
  
  const timer = setTimeout( () => {
   Velocity(iconEl, 'transition.bounceDownIn', 500);
  }, 1000);
  hideLoader(loaderEl);
};

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