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

              
                <form action="">

  <div class="field">
  <label for="postcode">
    <span class="field-label">Postcode (3 or 4 digits)</span>
    <span class="field-hint"><a href="http://auspost.com.au/postcode">Find a postcode</a> via Australia Post. Example: <samp>3000</samp>.</span>
    <span class="field-error">Enter your postcode.</span><!-- Only shown when validation triggers -->
  </label>
  <input name="postcode" id="postcode" type="text" autocomplete="postal-code" pattern="[0-9]*" inputmode="numeric" minlength="3" maxlength="4" value="4321">
</div>

</form>
              
            
!

CSS

              
                input[maxlength]{
  padding: 0.3rem 1ch;
  font-family: Consolas, “Andale Mono”, “Lucida Console”, “Lucida Sans Typewriter”, Monaco, “Courier New”, “monospace”; /* explanation for a monospaced font stack coming later */
  border: 2px solid #222;
  box-sizing: border-box;
  max-width: 100%; /* avoid spill over on narrow viewports */
}

input[maxlength="4"]{
  width: calc(4ch + 2ch + 1ch + 2px); /* maxlength + padding + breathing space + border */
}

/* basic visual styles */
body {
    font-family: Roboto,helvetica,arial,sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}
label, input, label span{
  display:block;
  font-size: 1.125rem;
  line-height: 1.38889;
}
.field-label {
  font-weight: 700;
}
.field-hint {
  color: #333;
  margin-bottom: 5px;
  font-size: .9em;
  display: block;
}
/* error styles - includes great contrasting colour from https://design-system.service.gov.uk/components/error-message/ */
.field-error {
  display: none;
  color: #D4351C;
  font-weight: 700;
  margin-bottom: 10px;
}
input[aria-invalid="true"] {
  border-color: #D4351C;
}


/* focus style */
[type=checkbox]:focus, [type=date]:focus, [type=email]:focus, [type=file]:focus, [type=number]:focus, [type=password]:focus, [type=radio]:focus, [type=search]:focus, [type=submit]:focus, [type=tel]:focus, [type=text]:focus, button:focus, select:focus, textarea:focus {
  outline: 0;
  box-shadow: 0 0 1px 4px #ffbf47;
}

/* Can you see that OK? CSS tips for low-vision accessibility https://youtu.be/Wq2-cZ-vZBc?t=15m7s */
form a {
  text-decoration: underline;
  text-decoration-skip-ink: auto;
}
              
            
!

JS

              
                
              
            
!
999px

Console