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="container">
  <p>
    Input should be a number. A letter will make it :invalid. Also a value that is in range (1-10) will also match just like <code>:in-range</code> would. The styles applied using <code>:in-range</code> would override the styles applied using <code>:valid</code> if they come after them in the style sheet. Try adding <code>:in-range</code> styles in the CSS to see this in action.
  </p>
  <input type="number" min="1" max="10" value="8">
  <p>
    Input type email. Email is optional, so it is valid even with no input. As you start typing, it will turn red and be considered :invalid until the input you're typing matches the pattern of a valid email address.
  </p>
  <input type="email">
  <p>
    Input type email. Email is required, so it will be invalid while it is empty and will validate only when you type in a value that matches the pattern of a valid email address.
  </p>
  <input type="email" required>
  <p>
    Input type URL. If the value you enter does not match the pattern of a URL, it will apply the invalid styles.
  </p>
  <input type="url">
</div>

              
            
!

CSS

              
                body {
  font-size: 1.2em;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

hr {
  margin: 50px 0;
}

.container {
  margin: 40px auto;
  max-width: 700px;
}

input {
  display: block;
  width: 50%;
  height: 2em;
  border-radius: 4px;
  border: 1px solid #999;
}

input[type="number"] {
  width: auto;
}

input:valid {
  background-color: #60b17c;
}

input:invalid {
  background-color: #a10000;
}
/*input[type="number"]:valid {
background-color: orange;
}
input[type="number"]:in-range {
background-color: yellow;
}*/

input:valid:focus {
  outline: 0;
  border: none;
  box-shadow: 0 0 3px 6px rgba(0, 200, 0, 0.3);
}

              
            
!

JS

              
                
              
            
!
999px

Console