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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <div class="content">
  <h2>Character Limits</h2>
  <p>See what happens when you exceed limit. Set the <code>data-limit</code> value to determine how many characters in the data limit.</p>
  <!--// Copy starts here -->
  <div class="input">
    <input data-limit="20" type="text" class="limited" placeholder="Fill me in ..." />
    <label class="counter"></label>
  <!--// Copy ends here -->
  <input type="submit" class="submit" value="Submit" />


                @import url(;

*, *:before, *:after {
  -webkit-box-sizing: border-box; 
  -moz-box-sizing: border-box; 
  box-sizing: border-box;
  padding: 0;
  margin: 0;

// Variables

@background: #e6e6e6;
@button: #007fed;
@error: #C26464;
@height: 40px;

// Styles

body {
  font-family: 'Open Sans', sans-serif;  
  color: darken(@background, 35%);  
  background: @background;
  font-weight: 100;
  font-size: 17px;

code {
  background: darken(@background,10%);
  color: darken(@background,45%);  
  font-size: 0.875em;  
  padding: 3px 6px;

h1,h2,h3 {
  font-weight: 100;
  font-size: 1.5em;

p { line-height: 1.8em; }

.content {
  max-width: 500px;
  margin: 50px auto;
  overflow: hidden;
  display: block;  
  padding: 50px;
  width: 80%;

.submit {
  background: lighten(@button,8%);  
  height: @height * 0.8;  
  margin-top: 10px;
  font-size: 14px;
  padding: 0 15px;
  color: #FFFFFF;
  display: block;
  outline: none;
  border: none;
  float: right;
  &:hover {
    background: @button;   
    cursor: pointer;
  &:disabled {
    background: darken(@background,5%);
    color: darken(@background,25%);
    cursor: not-allowed;

// The CSS you need to copy

.input {
  position: relative;
  margin-top: 20px;  
  .limited {
    border: 1px solid darken(@background, 10%);
    color: darken(@background,40%);        
    background: fade(#FFFFFF,80%);
    padding: 0 50px 0 20px;  
    line-height: @height;
    font-size: 0.875em;
    height: @height;    
    outline: none;    
    width: 100%;
  .counter {
    color: darken(@background,30%);    
    line-height: @height;
    text-align: center;
    position: absolute;  
    font-size: 0.875em;
    opacity: 0.4;
    height: 100%;
    width: 50px;
    right: 0; 
  .limited:hover + .counter,
  .limited:focus + .counter {
    opacity: 1;
  .is-over {
    border: 1px solid lighten(@error,20%); 
    background: fade(@error,5%);
    color: fade(@error,85%);

   & ~ .counter {
      color: fade(@error,85%);
      font-weight: 500;     


                $(function () {
  var runCalcs = function () {
    // Variables
    var limit = $('.limited');
    var text = limit.val().length;
    var max ='limit');
    var counter = $('.counter');    
    var count = (max - text);
    // Output Number
    counter.html( Math.abs(count) );
    if (count < 0) {
      $('.submit').attr('disabled', 'disabled');
    } else {
      $('.submit').removeAttr('disabled', 'disabled');
  $(window).ready(function () {    

    var changeOn = $('input, select');
    changeOn.on('keydown keyup keypress', function () {
    changeOn.trigger('keydown', 'keyup', 'keypress');