cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

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.

            
              
<!-- Try writing Invalid email -->

<div class="form-wrap">
  <div class="input">
<label for="mail">Email address</label>
<input type="email" name="mail" autocomplete="off">
</div>
 <svg class="line">
</svg>
</div>
            
          
!
            
              body {
  background: #002b36;
  font-family: 'Roboto Mono', monospace;
}

*:focus {
  outline: none;
}

.wrap {
  height: 100%;
  width: 100%;
  overflow: hidden;
  padding: 15px;
}

.form-wrap {
  position: relative;
  height: 50px;
  width: 400px;
  margin: 100px auto 0;
}

input {
  color: #fff;
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  padding-top: 5px;
  border: none;
  font-size: 1em;
  font-weight: 200;
  background: none;
  opacity: 0;
  font-family: 'Roboto Mono', monospace;
  transition: all 0.5s ease;
}

.active input {
  opacity: 1;
  transition: all 0.5s ease 0.5s;
}

svg {
  position: absolute;
  left: 0;
  top: 100%;
  overflow: visible;
  fill: none;
  z-index: 5;
  stroke: #fff;
  stroke-width: 3px;
}

label {
  color: #fff;
  position: absolute;
  top: 15px;
  font-size: 1.3em;
  transition: all 0.5s ease;
}

.active label {
  top: 0px;
  font-size: 1em;
  color: #FF5252;
  transition: all 0.5s ease 0.6s;
}

.active + svg {
  stroke: #FF5252;
  transition: stroke 0.4s ease 0.6s;
}

.input {
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.input:before {
  content: "";
  position: absolute;
  height: 26px;
  width: 3px;
  right: 15px;
  bottom: -50px;
  background-color: transparent;
  transform-origin: inherit;
  transform: rotate(0deg);
  transition: transform 0.4s ease, bottom 0.4s ease 0.3s, background-color 0.2s ease 0.6s;
}

.input:after {
  content: "";
  position: absolute;
  height: 26px;
  width: 3px;
  right: 15px;
  bottom: -50px;
  visibility: hidden;
  background-color: transparent;
  transform-origin: inherit;
  transform: rotate(0deg);
  transition: transform 0.4s ease, visibility 0.4s ease, bottom 0.4s ease 0.3s, background-color 0.2s ease 0.6s, height 0.2s ease 0.6s;
}

.valid:before {
  bottom: 10px;
  right: 16px;
  visibility: visible;
  background-color: #4CAF50;
  transform-origin: inherit;
  transform: rotate(40deg);
  transition: bottom 0.4s ease, transform 0.4s ease 0.3s;
}

.valid:after {
  bottom: 10px;
  height: 15px;
  visibility: visible;
  background-color: #4CAF50;
  transform-origin: inherit;
  transform: rotate(-45deg);
  transition: bottom 0.4s ease, visibility 0.4s ease 0.3s, transform 0.4s ease 0.3s;
}

.invalid:before {
  bottom: 10px;
  visibility: visible;
  background-color: #ff5252;
  transform: rotate(40deg);
  transition: bottom 0.4s ease, transform 0.4s ease 0.3s;
}

.invalid:after {
  height: 26px;
  bottom: 10px;
  visibility: visible;
  background-color: #ff5252;
  transform: rotate(-45deg);
  transition: bottom 0.4s ease, visibility 0.4s ease 0.3s, transform 0.4s ease 0.3s;
}
            
          
!
            
              'use strict';
var textInput = document.querySelector('input');
var inputWrap = textInput.parentElement ;
var inputWidth = parseInt(getComputedStyle(inputWrap).width);
var svgText = Snap('.line');
var qCurve = inputWidth / 2;  // For correct curving on diff screen sizes
var textPath = svgText.path("M0 0 " + inputWidth + " 0");
var textDown = function(){
    textPath.animate({d:"M0 0 Q" + qCurve + " 40 " + inputWidth + " 0"},150,mina.easeout);
};
var textUp = function(){
  textPath.animate({d:"M0 0 Q" + qCurve + " -30 " + inputWidth + " 0"},150,mina.easeout);
};
var textSame = function(){
  textPath.animate({d:"M0 0 " + inputWidth + " 0"},200,mina.easein);
};
var textRun = function(){
  setTimeout(textDown, 200 );
  setTimeout(textUp, 400 );
  setTimeout(textSame, 600 );
};

(function(){
    textInput.addEventListener('focus', function(){
      var parentDiv = this.parentElement;
      parentDiv.classList.add('active');
      textRun();
      this.addEventListener('blur', function(){
        var rg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.]{3,9})+\.([A-Za-z]{2,4})$/;
        this.value == 0 ? parentDiv.classList.remove('active') : null;
        !rg.test(this.value) && this.value != 0 ?
         (parentDiv.classList.remove('valid'), parentDiv.classList.add('invalid'), parentDiv.style.transformOrigin="center")
         : rg.test(this.value) && this.value != 0 ?
        (parentDiv.classList.add('valid'), parentDiv.classList.remove('invalid'), parentDiv.style.transformOrigin="bottom") :null;
        });
     parentDiv.classList.remove('valid', 'invalid')
    });
})();
            
          
!
999px
Loading ..................

Console