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="hidden-xs-up">
<svg style="display: none;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
      <symbol id="amex" viewBox="0 0 50 25">
        <style>
          .ast0
          {
              fill: #2557d6;
          }

          .st1
          {
              fill: #f47216;
          }

          .st2
          {
              fill: #d9222a;
          }

          .st3
          {
              fill: #ee9f2d;
          }

          .st4
          {
              fill: #fff;
          }

          .st5
          {
              fill: #0e4595;
          }
        </style>
        <path class="ast0" d="M36.1 6l-.9 2.2H37L36.1 6zM25.7 7.3c.2 0 .3-.2.3-.5 0-.2-.1-.4-.3-.5-.2-.1-.4-.1-.6-.1h-1.6v1.2H25c.3.1.5.1.7-.1zM5 6l-.8 2.2H6C5.9 8.2 5 6 5 6zm41.5 13.9H44v-1.2h2.5c.2 0 .4 0 .5-.1.1-.1.2-.2.2-.4s-.1-.3-.2-.4c-.1-.1-.2-.1-.5-.1-1.2 0-2.8 0-2.8-1.7 0-.8.5-1.6 1.9-1.6h2.6v-1.1h-2.4c-.7 0-1.3.2-1.6.4v-.4h-3.6c-.6 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 0-.5-.3-.7-.8-.7zm-11.3 0v1h2.9v1.1h-2.9v1.1h3.2l1.5-1.6-1.4-1.6h-3.3zm8.4 3.8V15l-2 2.2 2 2.2zm-8.3-8.7v.9h10.9v-2h.2c.1 0 .2 0 .2.3v1.7h5.7v-.5c.5.2 1.2.5 2.1.5H35l.5-1.2h1.1l.5 1.2h4.6v-1.1l.7 1.1h3.7V4h-3.6v.9L42 4h-3.7v.9l-.5-.9h-5c-.8 0-1.6.1-2.2.4V4h-3.5v.4c-.4-.3-.9-.4-1.5-.4H12.9L12 6l-.9-2h-4v.9L6.7 4H3.3L1.7 7.6v2.9L4 5h2l2.2 5.2V5.1h2.1L12 8.8l1.6-3.7h2.2v5.5h-1.3V6.3l-1.9 4.3h-1.1l-2-4.4v4.3H6.9l-.5-1.2H3.7l-.5 1.2H1.7v1.1H4l.5-1.2h1.1l.5 1.2h4.4v-.9l.4.9h2.3l.4-.9zm17.2-5c.4-.4 1.1-.6 2-.6H34v1.2h-1.2c-.5 0-.7.1-1 .3-.2.2-.4.7-.4 1.2 0 .6.1 1 .4 1.3.2.2.6.3.9.3h.6l1.8-4.3h2l2.2 5.2V5.1h2l2.3 3.8V5.1h1.3v5.4H43l-2.5-4.1v4.1h-2.7l-.5-1.2h-2.7l-.5 1.2h-1.5c-.6 0-1.4-.1-1.9-.6S30 8.8 30 7.8c.1-.8.2-1.5.8-2.1zm-2.7-.6h1.3v5.5h-1.3V5.1zm-6 0h3c.7 0 1.2 0 1.6.3.4.2.7.6.7 1.2 0 .9-.6 1.3-.9 1.5.3.1.5.3.6.5.2.3.2.5.2 1v1.1H26V10c0-.3 0-.8-.2-1.1-.2-.2-.5-.2-1-.2h-1.4v2h-1.3V5.1zm-5.3 0h4.4v1.1h-3.1v1h3v1.1h-3v1.1h3.1v1.1h-4.4V5.1z"></path>
      </symbol>
      <symbol id="discover" viewBox="0 0 50 25">
        <style>
          .st0
          {
              fill: #2557d6;
          }

          .bst1
          {
              fill: #f47216;
          }

          .st2
          {
              fill: #d9222a;
          }

          .st3
          {
              fill: #ee9f2d;
          }

          .st4
          {
              fill: #fff;
          }

          .st5
          {
              fill: #0e4595;
          }
        </style>
        <path class="bst1" d="M26.2 9.3c1.8 0 3.3 1.4 3.3 3.2 0 1.7-1.5 3.2-3.3 3.2-1.8 0-3.3-1.4-3.3-3.2-.1-1.7 1.4-3.2 3.3-3.2z"></path>
        <path d="M20.9 9.4c.5 0 1 .1 1.5.4v1.4c-.5-.5-1-.7-1.5-.7-1.2 0-2.1.9-2.1 2 0 1.2.9 2 2.1 2 .6 0 1-.2 1.5-.6v1.4c-.6.2-1 .3-1.5.3-1.9 0-3.3-1.4-3.3-3.1-.1-1.7 1.4-3.1 3.3-3.1zm-5.8 0c.7 0 1.3.2 1.8.7l-.6.8c-.3-.3-.6-.5-1-.5-.5 0-.9.3-.9.7 0 .3.2.5 1 .7 1.4.5 1.8.9 1.8 1.8 0 1.1-.9 1.9-2.2 1.9-.9 0-1.6-.3-2.2-1.1l.8-.7c.3.5.8.8 1.3.8s1-.4 1-.8c0-.2-.1-.5-.4-.6-.1-.1-.4-.2-.8-.3-1.2-.4-1.5-.8-1.5-1.6-.1-1 .8-1.8 1.9-1.8zm14 .1h1.3l1.7 4 1.7-4h1.3l-2.7 6.1h-.7M11.1 9.5h1.2v5.9h-1.2m24.6-5.9h3.5v1H37v1.3h2.2v1H37v1.6h2.3v1h-3.5m6.8-2.4c.9-.2 1.4-.8 1.4-1.7 0-1.1-.8-1.7-2.2-1.7H40v5.9h1.2v-2.4h.2l1.7 2.4h1.5l-2-2.5zm-1-.7h-.4v-1.8h.4c.8 0 1.2.3 1.2.9 0 .5-.4.9-1.2.9zM7.2 9.5H5.4v5.9h1.8c1 0 1.6-.2 2.2-.7.7-.6 1.1-1.4 1.1-2.3.1-1.6-1.3-2.9-3.3-2.9zM8.6 14c-.4.3-.9.5-1.7.5h-.3v-3.9h.3c.8 0 1.3.1 1.7.5.4.4.7.9.7 1.5 0 .5-.3 1-.7 1.4z"></path>
      </symbol>
      <symbol id="mastercard" viewBox="0 0 50 25">
        <style>
          .st0
          {
              fill: #2557d6;
          }

          .st1
          {
              fill: #f47216;
          }

          .cst2
          {
              fill: #d9222a;
          }

          .cst3
          {
              fill: #ee9f2d;
          }

          .cst4
          {
              fill: #fff;
          }

          .st5
          {
              fill: #0e4595;
          }
        </style>
        <path class="cst2" d="M28.7 12.5c0 6.2-5 11.2-11.2 11.2-6.2 0-11.2-5-11.2-11.2 0-6.2 5-11.2 11.2-11.2 6.2 0 11.2 5 11.2 11.2"></path>
        <path class="cst3" d="M32.5 1.3c-2.9 0-5.5 1.1-7.5 2.9-.4.4-.8.8-1.1 1.2h2.3l.9 1.2h-4c-.2.4-.5.8-.6 1.2h5.2c.1.4.3.8.4 1.2h-6.2l-.3 1.2h6.8c.2.8.3 1.6.3 2.4 0 1.2-.2 2.4-.6 3.5h-6.2c.1.4.3.8.5 1.2h5.2l-.6 1.2h-4c.3.4.5.8.9 1.2h2.3c-.3.4-.7.8-1.1 1.2 2 1.8 4.6 2.9 7.5 2.9 6.2 0 11.2-5 11.2-11.2-.1-6.3-5.1-11.3-11.3-11.3"></path>
        <path d="M42.2 18.7c0-.2.2-.4.4-.4s.4.2.4.4-.2.4-.4.4-.4-.2-.4-.4zm.3.3c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3-.2 0-.3.1-.3.3.1.2.2.3.3.3zm0-.1l-.1-.3h.2v.1s0 .1-.1.1l.1.1h-.1v-.1h-.1l.1.1zm0-.2h.1c0-.1 0-.1-.1 0 0-.1 0-.1 0 0zm-27.6-5h-.3c-.7 0-1 .2-1 .7 0 .3.2.5.4.5.5 0 .9-.5.9-1.2zm.9 2.1h-1v-.5c-.3.4-.7.6-1.3.6-.7 0-1.1-.5-1.1-1.3 0-1.1.8-1.8 2.1-1.8h.5v-.3c0-.3-.2-.4-.8-.4-.6 0-1.1.1-1.3.2 0-.1.2-1 .2-1 .6-.2 1-.2 1.5-.2 1 0 1.6.5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4 2.9-.6 4.3l-.1.3h1.2c.4-2.8.5-3.4 1.2-3.3.1-.6.3-1.1.5-1.3-.5-.1-.8.2-1.2.7 0-.2.1-.5.1-.7h-1.1m-10 0c-.2 1.4-.4 2.9-.6 4.3l-.1.3h1.2c.4-2.8.5-3.4 1.2-3.3.1-.6.3-1.1.5-1.3-.5-.1-.8.2-1.2.7 0-.2.1-.5.1-.7h-1.1m15.9 4.3c0-.2.2-.4.4-.4s.4.2.4.4-.2.4-.4.4c-.3-.1-.4-.2-.4-.4zm.3.3c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3-.2 0-.3.1-.3.3.1.1.2.3.3.3zm0-.2l-.1-.3h.2v.1s0 .1-.1.1l.1.1h-.1v-.1h-.1l.1.1zm0-.1h.1c0-.1 0-.1-.1 0 0-.1 0-.1 0 0z"></path>
      </symbol>
      <symbol id="visa" viewBox="0 0 50 25">
        <style>
          .st0
          {
              fill: #2557d6;
          }

          .st1
          {
              fill: #f47216;
          }

          .st2
          {
              fill: #d9222a;
          }

          .st3
          {
              fill: #ee9f2d;
          }

          .st4
          {
              fill: #fff;
          }

          .dst5
          {
              fill: #0e4595;
          }
        </style>
        <path class="dst5" d="M16.2 6.5L13 14.8l-.3-1.7V13l-1.1-5.5c-.2-.8-.8-1-1.5-1H4.5v.3C5.8 7 7 7.5 8 8.1l2.9 10.5h3.5l5.2-12.1h-3.4zm0 0zm4.9 0L19 18.6h3.3l2.1-12.1zm21.7 0h-2.6c-.8 0-1.4.2-1.7 1l-4.9 11.2h3.5s.6-1.5.7-1.8H42c.1.4.4 1.8.4 1.8h3.1L42.8 6.5zm-4 7.8c.3-.7 1.3-3.4 1.3-3.4s.3-.7.4-1.2l.2 1s.6 2.9.8 3.5h-2.7zm-7.8-3c-1.2-.6-1.9-.9-1.9-1.5 0-.5.6-1 1.9-1 1.1 0 1.9.2 2.5.5l.3.1.4-2.6c-.7-.2-1.7-.5-3-.5-3.3 0-5.6 1.7-5.6 4 0 1.7 1.6 2.7 2.9 3.3 1.3.6 1.7 1 1.7 1.5 0 .8-1 1.2-2 1.2-1.3 0-2-.2-3.1-.6l-.4-.2-.5 2.7c.8.3 2.2.6 3.7.6 3.5 0 5.8-1.6 5.8-4.2.1-1.4-.8-2.4-2.7-3.3zm3.3-4.6z"></path>
      </symbol>
    </svg>
</div>
<form action="" class="js-floating-labels" data-parsley-validate data-parsley-errors-messages-disabled>
  <div class="container">
    <div class="row">
      <div class=" col-sm-offset-3 col-sm-6 col-xs-12">
        <h6>ENTER CREDIT CARD INFORMATION</h6>
        <p>We will save it all</p>
        <div class="form-group credit-card-number">
          <label for="credit-card-number" class="floating">CARD NUMBER<span class="floating-desc">: Invalid Card Number</span></label>
          <input class="form-control" id="credit-card-number" name="credit-card-number" type="tel" inputmode="numeric" placeholder="CARD NUMBER" autocomplete="off" required="" data-parsley-creditcard>
          <svg class="payment-method-icon">
                <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#"></use>
              </svg>
        </div>
        <div class="row">
          <div class="col-sm-6">
            <div class="form-group">
              <label for="expiration" class="floating">EXPIRATION DATE<span class="floating-desc">: Invalid Expiration Date</span></label>
              <input class="form-control" id="expiration" name="expiration" type="tel" inputmode="numeric" placeholder="EXPIRATION DATE" autocomplete="off" data-parsley-required maxlength="7" data-parsley-expirydate />
            </div>
          </div>
          <div class="col-sm-6">
            <div class="form-group">
              <label for="ccv" class="floating">CCV<span class="floating-desc">: Invalid CCV</span></label>
              <input class="form-control" id="ccv" name="ccv" type="tel" maxlength="4" inputmode="numeric" placeholder="CCV" autocomplete="off" data-parsley-required data-parsley-cvv/>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col-sm-12">
          <div class="form-group">
            <button type="submit" class="btn btn-primary">SUBMIT</button>
          </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</form>
              
            
!

CSS

              
                // styles coming from external source

form {
  margin: 40px auto;
}
              
            
!

JS

              
                (function() {
  // Floating Labels
  const floatingLabelsInit = function() {
    // floating label function
    const floatingLabel = function(onload) {
      // input to target
      const $input = $(this);
      //on window load
      if (onload) {
        $.each($('.form-control'), function(index, value) {
          const $current_input = $(value);
          // if input is filled already - float label up
          if ($current_input.val()) {
            $current_input.siblings('label.floating').addClass('up');
          }
        });
      }
      // timeout function to check val
      setTimeout(function() {
        // if input has a value
        if ($input.val()) {
          // float label up
          $input.siblings('label.floating').addClass('up');
          // for selects only: add class to change text to black
          if ($input.is('select')) {
            $input.addClass('text-black');
          }
        } else {
          // else hide label if input gets cleared
          $input.siblings('label.floating').removeClass('up');
          // for selects only: remove class to change text to gray
          if ($input.is('select')) {
            $input.removeClass('text-black');
          }
        }
      }, 1);
    };

    // on keydown, change and window load - fire floating label function
    $('.form-control').keydown(floatingLabel);
    $('.form-control').change(floatingLabel);
    window.addEventListener('load', floatingLabel(true), false);

    // on parsley error
    $('.js-floating-labels').parsley().on('form:error', function() {
      $.each(this.fields, function(key, field) {
        // if validation fails float label up and add error class to form group
        if (field.validationResult !== true) {
          field.$element.siblings('label.floating').addClass('up');
          field.$element.closest('.form-group').addClass('has-error');
        }
      });
    });

    // on parsley passed validation
    $('.js-floating-labels').parsley().on('field:validated', function() {
      // if validation passes
      if (this.validationResult === true) {
        //remove error class from form group
        this.$element.siblings('label.floating');
        this.$element.closest('.form-group').removeClass('has-error');
      } else {
        // float label up and add error class to form group
        this.$element.siblings('label.floating').addClass('up');
        this.$element.closest('.form-group').addClass('has-error');
      }
    });
  };
  // Sets max length for ccv based on card type entered
  const ccvMaxLength = function(type) {
    if(type !== "amex") {
      $('#ccv').prop('maxlength', 3);
    }
  };
  // Updates elements and icon based on cc number
  const updatePaymentIcon = function() {
    // the svg for card icon
    const iconType = $('svg.payment-method-icon').children().attr('xlink:href');
    // the card type based on the number entered
    const cardType = $.payment.cardType($('#credit-card-number').val());
    // if cardType is null clear svg and return
    if (cardType === null) {
      $('svg.payment-method-icon').children().attr('xlink:href', '#');
      return;
    }
    
    //if the svg id is not equal to the card type update the svg id
    if (iconType.slice(1) !== cardType) {
      $('svg.payment-method-icon').children().attr('xlink:href', '#' + cardType);
    }
    
    // set the max length for the ccv based on card type
    ccvMaxLength(cardType);
    
    return;
  };
  // init invoke, make sure form has class js-floating-labels
  floatingLabelsInit();
  // format inputs with jquery.payment
  $('#credit-card-number').payment('formatCardNumber');
  $('#expiration').payment('formatCardExpiry');
  $('#ccv').payment('formatCardCVC');
  // on entry of cc number fire updatePaymentIcon function
  $('#credit-card-number').on("keyup blur", updatePaymentIcon);
  // custom cc validators added to parsley using jquery.payment functions
  window.validateCreditCard = $.payment.validateCardNumber;
  window.cardType = $.payment.cardType;
  window.Parsley.addValidator('creditcard',
      function(value) {
        const acceptedCards = ['amex', 'visa', 'mastercard'];
        return validateCreditCard(value) && acceptedCards.includes(cardType(value));
      })
    .addMessage('en', 'creditcard', '');
  window.Parsley.addValidator('cvv',
      function(value) {
        return /^[0-9]{3,4}$/.test(value);
      }, 32)
    .addMessage('en', 'cvv', '');
  window.Parsley.addValidator('expirydate',
      function(value) {
        var currentTime, expiry, prefix, ref;

        var date = value.split('/'),
          month = date[0].trim(),
          year = date[1].trim();

        if (!/^\d+$/.test(month)) {
          return false;
        }
        if (!/^\d+$/.test(year)) {
          return false;
        }
        if (!(parseInt(month, 10) <= 12)) {
          return false;
        }
        if (year.length === 2) {
          prefix = (new Date).getFullYear();
          prefix = prefix.toString().slice(0, 2);
          year = prefix + year;
        }
        expiry = new Date(year, month);
        currentTime = new Date;
        expiry.setMonth(expiry.getMonth() - 1);
        expiry.setMonth(expiry.getMonth() + 1, 1);
        return expiry > currentTime;
      }, 32)
    .addMessage('en', 'expirydate', '');
}());
              
            
!
999px

Console