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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                
<div class="fields-container">
  <h1>Interactive Form Concepts</h1>
    <form class="slide-form" id="placeholder-slide">
 
      <div class="slide-form-container">
        <input id="name" name="name" type="text" required>
        <label for="name">Username</label>
      </div>
      <div class="slide-form-container">
        <input id="password" name="password" type="text" required>
        <label for="password">Password</label>
      </div>

    </form>
    <hr>
    <form class="box-label-form" id="box-label">
 
      <div class="box-label-container">
        <input id="name-2" name="name" type="text" required placeholder="Username">
        <label for="name-2">
          <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="98.996px" height="117px" viewBox="0 0 98.996 117" enable-background="new 0 0 98.996 117" xml:space="preserve" class="icon">
          <g><g><path class="user-icon" fill="#FFFFFF" d="M79.966 33.306c0 16.736-13.563 30.306-30.298 30.306c-16.739 0-30.306-13.569-30.306-30.306 C19.362 16.6 32.9 3 49.7 3C66.404 3 80 16.6 80 33.306z"/><g><path class="user-icon" fill="#FFFFFF" d="M85.75 61.219H74.888c-6.494 6.41-15.402 10.385-25.22 10.385c-9.825 0-18.734-3.975-25.225-10.385 H13.579c-6.767 0-12.247 5.482-12.247 12.253v30.982c0 6.8 0.4 7.1 7.1 7.147h82.381c6.764 0 7.141-0.383 7.141-7.147 V73.472C97.996 66.7 92.5 61.2 85.8 61.219z"/></g></g></g></svg>
        </label>
      </div>
      
      <div class="box-label-container">
        <input id="password-2" name="password" type="text" required placeholder="Password">
        <label for="password-2">
          <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="98.996px" height="108.602px" viewBox="0 0 98.996 108.602" enable-background="new 0 0 98.996 108.602" xml:space="preserve" class="icon"><g><path fill-rule="evenodd" class="lock-icon" clip-rule="evenodd" fill="#FFFFFF" d="M81.478 43.878v-8.902C81.478 17.3 67.1 3 49.5 3 S17.52 17.3 17.5 34.976v8.902c-7.24 0.771-12.86 6.45-12.86 13.352v32.879c0 7.4 6.5 13.4 14.5 13.445h60.613 c8.029 0 14.531-6.02 14.531-13.445V57.229C94.335 50.3 88.7 44.6 81.5 43.878z M28.294 35 c0-11.687 9.512-21.198 21.203-21.198c11.692 0 21.2 9.5 21.2 21.198v8.807H28.294V34.976z"/></g></svg>
        </label>
      </div>
      
      <div class="box-label-container">
        <input id="incorrect-password" name="incorrect-password" type="text" required placeholder="Incorrect Password">
        <label for="incorrect-password">
          <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="98.996px" height="108.602px" viewBox="0 0 98.996 108.602" enable-background="new 0 0 98.996 108.602" xml:space="preserve" class="icon"><g><path fill-rule="evenodd" class="lock-icon" clip-rule="evenodd" fill="#FFFFFF" d="M81.478 43.878v-8.902C81.478 17.3 67.1 3 49.5 3 S17.52 17.3 17.5 34.976v8.902c-7.24 0.771-12.86 6.45-12.86 13.352v32.879c0 7.4 6.5 13.4 14.5 13.445h60.613 c8.029 0 14.531-6.02 14.531-13.445V57.229C94.335 50.3 88.7 44.6 81.5 43.878z M28.294 35 c0-11.687 9.512-21.198 21.203-21.198c11.692 0 21.2 9.5 21.2 21.198v8.807H28.294V34.976z"/></g></svg>
        </label>
      </div>

    </form>
    <hr>
  
    <form class="icon-slide-form" id="icon-slide-form">
 
      <div class="icon-slide-container">
        <input id="name-3" name="name" type="text" required placeholder="Username">
        <label for="name-3">
          <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="98.996px" height="117px" viewBox="0 0 98.996 117" enable-background="new 0 0 98.996 117" xml:space="preserve" class="icon">
          <g><g><path class="slide-user-icon" fill="#FFFFFF" d="M79.966 33.306c0 16.736-13.563 30.306-30.298 30.306c-16.739 0-30.306-13.569-30.306-30.306 C19.362 16.6 32.9 3 49.7 3C66.404 3 80 16.6 80 33.306z"/><g><path class="slide-user-icon" fill="#FFFFFF" d="M85.75 61.219H74.888c-6.494 6.41-15.402 10.385-25.22 10.385c-9.825 0-18.734-3.975-25.225-10.385 H13.579c-6.767 0-12.247 5.482-12.247 12.253v30.982c0 6.8 0.4 7.1 7.1 7.147h82.381c6.764 0 7.141-0.383 7.141-7.147 V73.472C97.996 66.7 92.5 61.2 85.8 61.219z"/></g></g></g></svg>
        </label>
      </div>
      <div class="icon-slide-container">
        <input id="password-3" name="password" type="text" required placeholder="Password">
        <label for="password-3">
          <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="98.996px" height="108.602px" viewBox="0 0 98.996 108.602" enable-background="new 0 0 98.996 108.602" xml:space="preserve" class="icon"><g><path fill-rule="evenodd" class="slide-lock-icon" clip-rule="evenodd" fill="#FFFFFF" d="M81.478 43.878v-8.902C81.478 17.3 67.1 3 49.5 3 S17.52 17.3 17.5 34.976v8.902c-7.24 0.771-12.86 6.45-12.86 13.352v32.879c0 7.4 6.5 13.4 14.5 13.445h60.613 c8.029 0 14.531-6.02 14.531-13.445V57.229C94.335 50.3 88.7 44.6 81.5 43.878z M28.294 35 c0-11.687 9.512-21.198 21.203-21.198c11.692 0 21.2 9.5 21.2 21.198v8.807H28.294V34.976z"/></g></svg>
        </label>
      </div>
    </form>

  
</div>
              
            
!

CSS

              
                @import "compass/css3";

@import url(https://fonts.googleapis.com/css?family=Varela+Round);

//Variables

$turquoise: #1abc9c;
$emerald: #2ecc71;
$lightRed: #e74c3c;
$red: #c0392b;
$lightPurple: #9b59b6;
$darkPurple: #220022;

//Base Styles

* { box-sizing: border-box }

html {
 background-color: $darkPurple;
}

body {
  font-family: 'Varela Round', sans-serif;
  color: #1e1e1e;
}

.fields-container  {
  width: 900px;
  height: 765px;
  background-color: whitesmoke;
  @include border-radius(5px);
  padding: 60px;
  text-align: center;
  @include box-shadow(#ccc 0px 8px 0px);
  margin: 0 auto;
  margin-top: 20px;
  margin-bottom: 30px;
}

.center   {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

h1   {
  color: $lightPurple;
  position: relative;
  margin: 0 auto;
  margin-bottom: 40px;
  margin-top: -30px;
  font-size: 28px;
  text-align: center;
  font-weight: bold;
  border-bottom: 1px solid $emerald;
  padding-bottom: 15px;
  width: 400px;
}

hr   {
  margin-bottom: 50px;
  margin-top: 30px;
  width: 80%;
}

//Float Label Styles

.slide-form   {
  input[type="text"] {
    height: 45px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 780px;
    @include border-radius(2px);
    border: 1px solid $lightPurple;
    padding: 14px;
    padding-left: 20px;
    position: relative;
    font-family: 'Varela Round', sans-serif;
    font-size: 16px;
    background-color: whitesmoke;
    
  }
  
  input[type="text"]:focus   {
    outline: none;
  }
  
  div { position: relative; }
  
  label {
    position: absolute;
    top: 14px;
    left: 18px;
    color: $lightPurple;
    padding: 0 4px;
    @include transition-property(all);
    @include transition-duration(.15s);
    @include transition-timing-function(ease-out);
  }
  
}

.slide-form input:focus + label, .slide-form input:valid + label {
    top: -8px;
    background-color: whitesmoke;
    padding: 0 4px;
  
}

.slide-form input:focus   {
   @include box-shadow($lightPurple 0px -3px 0px inset);
}


//Box Label Form Styles

.box-label-form  {
  
  input[type="text"] {
    height: 45px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 780px;
    @include border-radius(2px);
    border: 1px solid $lightPurple;
    padding: 14px;
    padding-left: 80px;
    position: relative;
    font-family: 'Varela Round', sans-serif;
    font-size: 16px;
    background-color: whitesmoke;
    @include transition-property(all);
    @include transition-duration(.3s);
    @include transition-timing-function(ease-out);
  }
  
  input[type="text"]:focus   {
    outline: none;
  }
  
  div { position: relative; }
  
  label {
    position: absolute;
    top: 0px;
    left: 0px;
    background-color: $lightPurple;
    height: 45px;
    width: 70px;
    padding: 0 4px;
    border: 1px solid $lightPurple;
    border-right: none;
    @include border-radius(2px);
    @include transition-property(all);
    @include transition-duration(.3s);
    @include transition-timing-function(ease-out);
  }
  
}

.icon   {
  height: 20px;
  width: 20px;
  margin-top: 11px;
    @include transition-property(all);
    @include transition-duration(.3s);
    @include transition-timing-function(ease-out);
  
}

.box-label-form input:valid + label   {
   @include box-shadow($emerald 100px 0px 0px inset);
  border: 1px solid $emerald;
  border-right: none;
}

.box-label-form input:valid   {
  border: 1px solid $emerald;
}

.box-label-form #incorrect-password:valid + label   {
  @include box-shadow($lightRed 100px 0px 0px inset);
  border: 1px solid $lightRed;
  border-right: none;
}

.box-label-form #incorrect-password:valid   {
  border: 1px solid $lightRed;
}

.box-label-form input:focus + label > .icon  {
  height: 28px;
  width: 28px;
  margin-top: 7px;
}

//Icon Slide Form Styles

.icon-slide-form  {
  
  input[type="text"] {
    height: 45px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 780px;
    @include border-radius(2px);
    border: 1px solid $lightPurple;
    padding: 14px;
    padding-left: 55px;
    position: relative;
    font-family: 'Varela Round', sans-serif;
    font-size: 16px;
    background-color: whitesmoke;
    @include transition-property(all);
    @include transition-duration(.3s);
    @include transition-timing-function(ease-out);
  }
  
  input[type="text"]:focus   {
    outline: none;
  }
  
  div { position: relative; }
  
  label {
    position: absolute;
    top: 0px;
    left: 0px;
    background-color: $lightPurple;
    height: 45px;
    width: 45px;
    padding: 0 4px;
    border: 1px solid $lightPurple;
    border-right: none;
    @include border-radius(2px);
    @include transition-property(all);
    @include transition-duration(.3s);
    @include transition-timing-function(ease-out);
  }
  
  .icon   {
  height: 30px;
  width: 30px;
  margin-top: 6px;
  @include border-radius(2px);
    @include transition-property(all);
    @include transition-duration(.3s);
    @include transition-timing-function(ease-out);
  
  }
}



.icon-slide-form input:valid + label   {
  background-color: $emerald;
  border: 1px solid $emerald;
  border-right: none;
}

.icon-slide-form input:valid   {
  border: 1px solid $emerald;
}

.icon-slide-form input:focus + label {
    background-color: transparent!important;
    border: 1px solid $lightPurple;
    border-right: none;
}

.icon-slide-form input:focus   {
  border: 1px solid $lightPurple!important;
}

.icon-slide-form input:focus   {
  padding-left: 10px;
}

.icon-slide-form input:focus + label > .icon {
  margin-left: -90px;
  

}
.icon-slide-form input:focus + label > .icon .slide-user-icon, .icon-slide-form input:focus + label > .icon .slide-lock-icon  {
  fill: $lightPurple;
}



              
            
!

JS

              
                // No JS required!
              
            
!
999px

Console