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

              
                <!-- All modern browsers support the [constraint validation API](https://www.w3.org/TR/html5/sec-forms.html#the-constraint-validation-api), a series of JavaScript methods for validating form controls. -->
<div class="container">
  <div class="Header">
    <h2>Form Submission</h2>
    <h3>Introduction</h3>
    <p>This section is non-normative. When a form is submitted, the data in the form is converted into the structure
      specified by the <a
        href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fs-enctype">enctype</a>,
      and then sent to the destination specified by the <a
        href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fs-action">action</a>
      using the given <a
        href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fs-method">method.</a>
    </p>
  </div>
  <form action="/find.cgi" method=get>
    <input type="text" name="t">
    <input type="search" name="q">
    <input type="submit">
  </form>
</div>
<hr />
<!-- Form 2 -->
<div>
  <div class="container">
    <h2>Form 2 - Essay Submission</h2>
    <p>This attribute is useful to include "save" buttons on forms that have validation constraints, to allow users to
      save their progress even though they haven't fully entered the data in the form. The following example shows a
      simple form that has two required fields. There are three buttons: one to submit the form, which requires both
      fields to be filled in; one to save the form so that the user can come back and fill it in later; and one to
      cancel the form altogether.</p>
    <form action="editor.cgi" method="post">
      <p><label>Name: <input required name=fn></label></p>
      <p><label>Essay: <textarea required name=essay></textarea></label></p>
      <p><input type=submit name=submit value="Submit essay"></p>
      <p><input type=submit formnovalidate name=save value="Save essay"></p>
      <p><input type=submit formnovalidate name=cancel value="Cancel"></p>
    </form>
  </div>
</div>
              
            
!

CSS

              
                small success {
  visibility: none;
  border-color: green;
}

small error {
  border-color: red;
}

              
            
!

JS

              
                function check(input) {
  if (
    input.value == "good" ||
    input.value == "fine" ||
    input.value == "tired"
  ) {
    return input.setCustomValidity('"' + input.value + '" is not a feeling.');
  } else {
    // input is fine -- reset the error message
    return input.setCustomValidity("Success");
  }
}

              
            
!
999px

Console