cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="animated-form">
  <input type="text"
         name="login"
         id="basic-text"
         autocapitalize="off"
         autocorrect="off"
         required>
  <label for="basic-text">Name</label>
</div>

<div class="animated-form">
  <input type="text"
         name="login2"
         id="basic-text2"
         autocapitalize="off"
         autocorrect="off"
         required>
  <label for="basic-text2">Email</label>
</div>
            
          
!
            
              // simple animated form elements that work in modern browsers, android, ios devices

// variables used below for color 
@form-label-txt: #4c4b4b;
@form-focus: #b8242b;

// default fieldset and any tack on classes to change how it behaves.
.animated-form {
  position: relative;
  width: 50%;
  margin: 20px auto;

  input, select  {
    display: block;
    width: 100%;
    height: 46px;
    outline: 0;
    appearance: none;
    border: 0; // removes browser/device default
    line-height: 1;
    background: rgba(255,255,255,0.8); // when on darker bkg, shows as semi transparent. 
    transition: all 0.2s ease-in-out;
    box-shadow: 0 0 4px rgba(0,0,0,0.4);
    padding: 0 0 0 8px; // matches the padding for :focus, so we don't push the form outside it's container

    &:focus {
      background: rgba(255,255,255,1);
      // brings the field into 'focus', taking trasnparency off the bkg. 
      outline: 0;
    }
      
    &:valid,
    &:focus {
      padding: 24px 0 0 8px;
      color: @form-focus;
      font-weight: 700;
      font-size: 17px;
      transform: translate3d(0, -10px, 0);
    }

    &:valid + label,
    &:focus + label  {
      color: @form-label-txt;
      font-weight: 700;
      transform: translate3d(0, -10px, 0);
      font-size: 14px;
    }
  }
  
  // Animation on <label>
    label {
      position: absolute;
      top: 15px;
      left: 8px;
      color: @form-label-txt;
      font-size: 17px;
      transform: translate3d(0, 0, 0);
      transition: all 0.2s ease-in-out;
    }
  } // ends animated form


// general body stuff. 
body {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 17px;
  background: #383737;
}

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console