Pen Settings



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


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.


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.


                <div style="margin: 2em auto; max-width: 400px;">

  <form novalidate>

    <div class="input-wrap">
      <label for="n">
        Name (not required):
      <input type="text" id="n" class="txt-field" aria-describedby="n_msg">
      <span id="n_msg">Try not to be clever</span>

    <div class="input-wrap">
      <label for="e">
      <input type="email" id="e" class="txt-field" aria-invalid="false" required data-error="e_msg" aria-describedby="e_msg" data-msg="Your email is required.">
      <span id="e_msg"></span>

    <div class="input-wrap">
      <label for="num">
      <input type="number" id="num" class="txt-field" aria-invalid="false" required data-error="nu_msg" aria-describedby="nu_msg" data-msg="A numeric value must be entered.">
      <span id="nu_msg"></span> 

    <div class="input-wrap">
      <label for="rn2">
        Name (no default invalid false):
      <input type="text" id="rn2" class="txt-field" data-error="rn2_mess" aria-describedby="rn2_mess" data-msg="Your name is required." required>
      <span id="rn2_mess"></span>

    <div class="input-wrap">
      <label for="rn2bbb">
      </label> <span id="help">(first and last)</span>
      <input type="text" id="rn2bbb" class="txt-field" data-error="rn2bbb_mess" aria-describedby="rn2bbb_mess help" data-msg="Your name is required." required aria-invalid="false">
      <span id="rn2bbb_mess"><!-- populate error message here as needed --></span>

    <div class="input-wrap">
      <label for="rn">
      <input type="text" id="rn" class="txt-field" aria-invalid="false" data-error="rn_mess" aria-describedby="rn_mess" data-msg="Your name is required." required>
      <span id="rn_mess"></span>

    <div class="input-wrap">
      <label for="req_mess">
        Message (req):
      <textarea id="req_mess" class="txt-field" data-msg="You must enter a message." aria-invalid="false" data-error="rmess_msg" aria-describedby="rmess_msg" required></textarea>
      <span id="rmess_msg"></span>

    <button style="margin-top: 2em;
                   border: 2px solid;
                   padding: .5em 2em;
                   font-size: inherit;"



body {
  background: #fcfcfc;
  font-family: arial;
  font-size: 100%;
  margin: 0;
  padding: 0;

*:after {
  box-sizing: border-box;

body {
  line-height: 1.4;

.input-wrap:not(:first-of-type) {
  margin-top: 1.5em;

.txt-field {
  border: 1px solid #63738a;
  box-shadow: none;
  font-size: inherit;
  padding: .5em;
  width: 100%;

.txt-field[disabled] {
  background: #e8ebf0;

.txt-field[readonly] {
  background: #fafafa;

.txt-field:hover:not([disabled]) {
  outline: 1px solid #63738a;

.txt-field:focus {
  border-color: #0062b2;
  outline: 1px solid #0062b2;

.txt-field[aria-invalid="true"]:invalid:not(:focus) {
  border-color: #d6312b;
  outline: 1px solid #d6312b;

.txt-field[aria-invalid="true"] + span {
  color: red;
  font-weight: bold;

textarea.txt-field {
  resize: vertical;
  max-height: 10em;
  min-height: 4em;



                (function () {
  var fields = document.querySelectorAll('.txt-field[required]');

  var checkIt = function ( e ) {
    var msg;

    if ( this.hasAttribute('data-msg') ) {
      msg = document.getElementById(this.getAttribute('data-error'));

    if ( this.required && this.validity.valid ) {
      this.setAttribute('aria-invalid', 'false');
      msg.innerHTML = '';
      this.removeEventListener('keyup', checkIt, false);
    else if ( this.required && !this.validity.valid  ) {
      this.setAttribute('aria-invalid', 'true');
      msg.innerHTML = this.getAttribute('data-msg');
      this.addEventListener('keyup', checkIt, false);


  for ( var i = 0; i < fields.length; i++ ) {
    fields[i].addEventListener('blur', checkIt, false);