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

              
                <div class="box">
  
  <h2>Login</h2>
  
  <form action="">
    
    <!-- Login -->
    
    <div class="login-form">
      
      <label for="username">Username</label>
      <input type="text" id="username" placeholder="Username">
      
      <label for="password">Password</label>
      <input type="password" id="password" placeholder="Password">
      
    </div>
    
    <!-- Register -->
    
    <div class="register-form">
      
      <label for="first-name">First Name</label>
      <input disabled type="text" id="first-name" placeholder="First Name">
      
      <label for="last-name">Last Name</label>
      <input disabled type="text" id="last-name" placeholder="Last Name">
      
      <label for="email">E-mail Adress</label>
      <input disabled type="text" id="email" placeholder="E-mail Address">
      
      <label for="confirm-email">Confirm E-mail Address</label>
      <input disabled type="text" id="confirm-email" placeholder="Confirm E-mail Address">
      
      <div class="captcha">
        <label for="captcha">What is <strong>10 + 3</strong>?</label>
        <input disabled type="text" id="captcha" placeholder="Your answer">
        
      </div>
      
    </div>
    
    <!-- Submit -->
    
    <input type="submit" id="submit" value="Login">
    
    <!-- Help -->
    
    <a href="register.htm" class="register">Register!</a>
    <a href="#" class="forgot-password" title="Forgot password?">Forgot?</a>
    
  </form>
</div>
              
            
!

CSS

              
                * { box-sizing: border-box }
html, body {
  display: table;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #eee;
}
body {
  display: table-cell;
  vertical-align: middle;
}
.box {
  margin: auto;
  padding: 25px 50px;
  width: 350px;
  min-height: 115px;
  background: #fff;
  border-left: 5px solid #9b2;
  box-shadow: 0 0 20px rgba(0,0,0,.15);
  font: 12px/15px Arial, Helvetica, sans-serif;
  color: #666;
}
h2 {
  margin: 0 10px;
  line-height: 40px;
}
form {
  padding: 0 10px 10px;
}
form::after {
  content: "";
  display: block;
  clear: both;
}
label {
  position: absolute;
  left: -9999px;
}
input {
  position: relative;
  z-index: 10;
  margin: 0;
  padding: 0 5px;
  width: 225px;
  height: 30px;
  border: 1px solid #ccc;
}
input:focus {
  z-index: 15;
  box-shadow: 0 0 10px rgba(0,0,0,.1);
  outline: 0;
}
#password {
  top:-1px;
  margin-bottom: 5px;
}
.register-form {
  display: none;
}
.register-form input {
  margin: -1px 0;
}
#first-name {
  margin-top: 5px;
}
.captcha {
  margin: 10px 0;
}
.captcha label {
  position: relative;
  left: 0;
}
#submit {
  float: right;
  padding: 0;
  width: 75px;
  background: #9b2;
  color: #140;
  border-color: #471;
}
#submit:hover {
  color: #025;
  background: #28e;
  border-color: #16c;
}
#submit ~ a {
  display: block;
  float: left;
  width: 120px;
  text-decoration: none;
  color: #666;
}
#submit ~ a:hover {
  text-decoration: underline;
}
              
            
!

JS

              
                (function( $ ){
	   
  // Easing equation based on
  // EaseInOutExpo by Robert Penner (c) 2001
  // robertpenner.com/easing_terms_of_use.html
  
  $.fn.extend( jQuery.easing, {
    eioe: function( ø, t, b, c, d ) {
      if(t==0) return b;
      if(t==d) return b+c;
      if( (t /= d/2) < 1 ) return c/2 * Math.pow( 2, 10 * (t - 1) ) + b;
      return c/2 * ( -Math.pow( 2, -10 * --t ) + 2 ) + b;
    }
  });
  
  // Toggle disabled
  // http://stackoverflow.com/questions/4702000/jquery-toggle-input-disabled-attribute#comment5189637_4702086
  
  $.fn.toggleDisabled = function() {
    return this.each(function() {
      this.disabled = !this.disabled;
    });
  };
  
  // Toggle attribute value
  // Anders Grimsrud, 2013
  
  $.fn.toggleAttr = function(a, v1, v2) {
    return this.each(function() {
      var $t = $(this),
          v  = $t.attr(a) === v1 ? v2 : v1;
      $t.attr(a, v)
        });
  };
  
  // Toggle login/register form
  
  $('.register').click(function(){
    
    // Toggle register form and enable inputs
    $('.register-form').slideToggle({
      easing: 'eioe',
      duration: 250
    }).find('input').toggleDisabled();
    
    // Change header
    // Login -> Register
    var $h2 = $('.box h2'),
        headerText = $h2.text() === "Login" 
        ? "Register" 
        : "Login";
    $h2.text(headerText);
    
    // Change submit button value
    // Login -> Register
    $('#submit').toggleAttr('value','Login','Register');
    
    // Change signup link
    // Signup -> Login link
    var $su = $('.register');
    $su.toggleAttr('href','register.htm','login.htm')
      var signupLinkText = $su.text() === "Register!" 
          ? "Login!" 
          : "Register!";
    $su.text(signupLinkText);
    
    // Hide Forgot password link
    $('.forgot-password').toggle();
    
    // Change form action
    // login.php -> register.php
    $('form').toggleAttr('action','login.php','register.php')
      
      return false;
  });
  
})(jQuery);
              
            
!
999px

Console