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="wrapper">
  <div class="form-section current front">
    <h1>Check Yourself Out <i class="fa fa-lock" aria-hidden="true"></i></h1>
    <form id="cardinfo" name="ccform">
    <input name="cardnumber" onkeypress='validate(event)' placeholder="Card Number" class="cardnumber form-field" type='tel' required/>
    <input class="cardname form-field" type="text" placeholder="Name" required/>
    <input onkeypress='validate(event)' class="month form-field" type="text" placeholder="DD" maxlength="2" required/><span>/</span>
    <input class="year form-field" type="text" placeholder="YY" maxlength="2" required/>
      <input id="submit1" class="button1" type="submit" value="NEXT" />
    </form>
  </div>
  <div class="form-section back">
    <h1>Continue Checkout <i class="fa fa-lock" aria-hidden="true"></i></h1>
     <form id="cardinfo2">
    <input id="cvv" class="cvv" type="text" placeholder="CVV" maxlength="4" required/>
       <input id="submit2" type="submit" />
    </form>
  </div>
</div>
<h1 class="success"><i class="fa fa-thumbs-o-up" aria-hidden="true"></i> Much Success!</h1>
              
            
!

CSS

              
                @font-face{
    font-family:Credit;
    font-weight:100;
    src:local(※), url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/383755/halter__-webfont.woff) format('woff');
}

$main : 'Credit', sans-serif;
$header : 'Inconsolata', monospace;
$gray : #eee;
$purple : #9249ff;
$white : #fff;

@mixin centered(){
  position:absolute;
  left:50%;
  top:50%;
  transform:translateX(-50%) translateY(-50%);
}

body{
    margin:0px;
    background:$gray;
    height:100vh;
    width:100%;
    overflow:hidden;
    transition:0.3s ease-in-out;
      &:before{
      content:'';
      transition:0.3s ease-in-out;
      width:350%;
      height:250%;
      display:block;
      position:absolute;
      right:-10%;
      top:-10%;
      background: -moz-radial-gradient(center, ellipse cover,  $purple 0%, rgba(0,0,0,0) 40%); /* FF3.6-15 */
      background: -webkit-radial-gradient(center, ellipse cover,  $purple 0%,rgba(0,0,0,0) 40%); /* Chrome10-25,Safari5.1-6 */
      background: radial-gradient(ellipse at center,  $purple 0%,rgba(0,0,0,0) 40%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
      filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */

    }
  .wrapper{
    display:block;
    position:relative;
    width:100vw;
    height:100vh;
    -webkit-perspective: 800px;
    perspective: 800px;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;

    .form-section{
      position:absolute;
      width:500px;
      height:300px;
      border-radius:15px;
      border:4px solid $purple;
      padding:2em;
      backface-visibility: hidden;
      justify-content:flex-start;
      box-shadow:0px 25px 25px -20px darken($gray, 10%);
      @include centered();
      form{
        position:absolute;
        bottom:1em;
        max-width:90%;
        left:1.5em;
      }
      h1{
          font-family:$header;
          font-size:2.5em;
          position:absolute;
          left:1em;
          top:0.5em;
          color:$purple;
          width:90%;
        i{
          font-size:1.25em;
          display:inline-block;
          margin-top:-0.15em;
          margin-right:0.25em;
          float:right;
        }
        }
      .innerwrap{
        height:auto;
        align-self:flex-end;

      }
      input{
        width:100%;
        flex:flex-grow;
        clear:both;
        background:transparent;
        border:0px solid;
        border-bottom:4px solid $purple;
        font-family:$main;
        color:$purple;
        font-size:1.4em;
        margin-bottom:1em;
        &::-webkit-input-placeholder{
          color:darken($gray, 15%);
        }
        &:focus{
          outline:none;
          border-bottom:4px solid transparent;
        }
        &:invalid{
          border-bottom:4px solid $purple;
        }
        &:valid{
          border-bottom:4px solid transparent;
        }
      }
      .cardname{
        width:73.2%;
        text-transform:uppercase;
      }
      .month{
        width:8%;
        margin:0 1%;
      }
      .year{
        width:8%;
      }
      span{
        color:$purple;
        font-size:1.5em;
      }
    }
    input.show{
      display:inline-block !important;
      transition:0.2s ease-in-out;
      position:absolute;
      bottom:-80px;
      right:-90px;
      max-width:140px;
      background:$purple;
      text-align:center;
      padding:0.6em 0;
      color:$white;
      border:4px solid $purple;
      border-bottom:4px solid $purple !important;
      border-radius:10px;
      animation-name:scaleIn;
      animation-duration:0.4s;
      animation-iteration-count:1;
      @keyframes scaleIn{
        0%{
          transform:scale(0);
        }
        80%{
          transform:scale(1.05);
        }
        100%{
          transform:scale(1);
        }
      }
      &:hover{
        color:$purple;
        background:$gray;
      }
      
    }
    input[type="submit"]{
      font-family:$header;
      letter-spacing:2px;
      display:none;
    }
    .front{
      z-index: 2;
      background:$gray;
      &:before{
        content:'';
        position:absolute;
        width:100%;
        height:100%;        
        background:url('https://puu.sh/qMT9D/a44061812c.svg');
        background-size:10px;
        border-radius:15px;
        z-index:-5;
        top:20px;
        left:20px;
      }
      &:after{
        content:'';
        position:absolute;
        width:100%;
        height:100%;        background:$gray;
        background-size:10px;
        border-radius:15px;
        z-index:-4;
        top:0;
        left:0;
      }
    }
    .back{
      transform:translateX(-50%) translateY(-50%) rotateY(180deg);
      z-index:1;
      &:before{
        content:'';
        position:absolute;
        width:100%;
        height:100%;          background:url('https://puu.sh/qMT9D/a44061812c.svg');
        background-size:10px;
        border-radius:15px;
        z-index:-5;
        top:20px;
        left:-20px;
      }
      &:after{
        content:'';
        position:absolute;
        width:100%;
        height:100%;        
        background:$gray;
        background-size:10px;
        border-radius:15px;
        z-index:-4;
        top:0;
        left:0;
      }
      form{
        position:absolute;
        top:70%;
        left:50%;
        transform:translateX(-50%) translateY(-50%);
        width:20%;
      }
      .cvv{
        max-width:100%;
        float:right;
        text-align:center;
      }
      #submit2{
        display:block;
        width:180px;
        position:absolute;
        left:50%;
        transform:translateX(-50%);
        bottom:-50%;
        text-transform:uppercase;
        background:$purple;
        color:$white;
        border-radius:10px;
        padding:0.5em 0;
        transition:0.2s ease-in-out;
        border:4px solid $gray;
        &:hover{
          background:$gray;
          color:$purple;
          border:4px solid $purple;
        }
      }
      h1{
        &:after{
          content:'';
          position:absolute;
          display:block;
          width:120%;
          height:60px;
          left:-1em;
          max-width: 565px;
          top:120%;
          background:$purple;
        }
      }
     }
  }
}

.success{
  position:absolute;
  @include centered();
  color:$white;
  font-family:$header;
  font-size:2em;
  top:100%;
  transition-delay:0.4s;
  transition:0.4s ease-in-out;
}

.submitted{
  background:$purple;
  .success{
    top:50%;
  }
  &:before{
      content:'';
      width:350%;
      height:250%;
      display:block;
      position:absolute;
      right:-10%;
      top:-10%;
      background: -moz-radial-gradient(center, ellipse cover,  $gray 0%, rgba(0,0,0,0) 40%); /* FF3.6-15 */
      background: -webkit-radial-gradient(center, ellipse cover,  $gray 0%,rgba(0,0,0,0) 40%); /* Chrome10-25,Safari5.1-6 */
      background: radial-gradient(ellipse at center,  $gray 0%,rgba(0,0,0,0) 40%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
      filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
  }
}


              
            
!

JS

              
                $('input.cardnumber').payment('formatCardNumber');

$("#cardinfo").submit(function(e){
    TweenMax.to(".wrapper", 1.5, {transformOrigin:"50% 50%", delay:0, rotationY:180, ease: Elastic.easeOut.config(0.3, 0.3)});
    $("#cvv").focus();
    return false;
    
});

$("#cardinfo2").submit(function(e){
    TweenMax.to(".form-section", .5, {transformOrigin:"50% 50%", delay:0, y:-1000, ease: Elastic.easeOut.config(0.3, 0.3)});
    $('body').addClass('submitted');
    return false;
});

function validate(evt) {
  var theEvent = evt || window.event;
  var key = theEvent.keyCode || theEvent.which;
  key = String.fromCharCode( key );
  var regex = /[0-9]|\./;
  if( !regex.test(key) ) {
    theEvent.returnValue = false;
    if(theEvent.preventDefault) theEvent.preventDefault();
  }
}

$('.year').keyup(function(){
        if(this.value.length==$(this).attr("maxlength")){
            $('.button1').addClass("show");
        }
    });
              
            
!
999px

Console