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

              
                <html>
  <section>
    <h4>
      This number input relies on the language set by the browser/OS for localization.
      <br>e.g. for British English (en-GB) only a "." (period) will work as a decimal separator.
    </h4>
    <label for="#numNativeIn">
      <code>&lt;input type=number inputmode=<span class="currentInputMode">undefined</span>&gt;</code><br>
      <code>// navigator.language=<u><span class="navLang"></span></u></code>
      
    </label><br>
    
    <input id="numNativeIn" type="number" step=0.1
           onInput="showValue(this, 'numNative')"><br>
    <strong><u><output id="numNativeOut"></output></u></strong> <i><output id="numNativeValid"></output></i>
  </section>
  <hr>
  <section>
    <h4>
      This number input will conform to the localization specified by its   <code>lang</code> attribute.
      <br>e.g. for French Canadian, the "," (comma) decimal separator will work and will be standardised to a floating point number.
    </h4>
    <label for=numLangIn>
      <code>
        &lt;input type=number 
        inputmode=<span class="currentInputMode">undefined</span>
        lang=<u>fr-CA</u>&gt;
      </code>
    </label><br>
    
    <input id="numLangIn" type="number" step=0.1 lang="fr-CA"
           onInput="showValue(this, 'numLang')"><br>
    <strong><u><output id="numLangOut"></output></u></strong> <i><output id="numLangValid"></output></i>
  </section>
  <hr>
  <section>
    <h4>
      This text input will open a virtual keyboard corresponding to its, or its parent's, <code>inputmode</code> attribute.
    </h4>
    <label for=textNativeIn>
      <code>
        &lt;input type=text
        inputmode=<span class="currentInputMode">undefined</span>&gt;
      </code>
    </label><br>
    
    <input id="textNativeIn" type="text" 
           onInput="showValue(this, 'textNative')"><br>
    <strong><u><output id="textNativeOut"></output></u></strong> <i><output id="textNativeValid"></output></i>
  </section>
  <hr>
  <section>
    <label for="inputMode">
      change <code>inputmode</code> attribute
    </label><br>

    <select id="inputMode" list="inputModes" onInput="setMode(this.value)">
      <option value="none">none</option>
      <option value="text" selected>text (default)</option>
      <option value="tel">tel</option>
      <option value="url">url</option>
      <option value="email">email</option>
      <option value="numeric">numeric</option>
      <option value="decimal">decimal</option>
      <option value="search">search</option>
    </select>
    
    <p>
      <small><span id="inputDescription"></span></small>
    </p>
    <button onClick="toggleHeadings()">Toggle headings</button>
  </section>
</html>

              
            
!

CSS

              
                .hide {
  display: none;
}
              
            
!

JS

              
                function setLanguage () {
  Array.from(document.querySelectorAll(".navLang"))
    .map((e) => e.innerText = navigator.language)
}

setLanguage()

window.addEventListener("languagechange", setLanguage)

function showValue (input, target) {
  const out = document.querySelector(`#${target}Out`),
        valid = document.querySelector(`#${target}Valid`)
  
  out.value = input.value
  valid.innerText = input.checkValidity() ? "valid" : "error"
}

function setMode (inputMode) {
  Array.from(document.querySelectorAll('input'))
    .map(e => e.inputmode = inputMode)

  Array.from(document.querySelectorAll(".currentInputMode"))
    .map(e => e.innerText = inputMode)
  
  document.querySelector("#inputDescription")
    .innerText = keywords[inputMode]
}

function toggleHeadings () {
  Array.from(document.querySelectorAll("h4"))
    .map(e => e.classList.toggle("hide"))
}

let keywords = {
  none:	`The user agent should not display a virtual keyboard. This keyword is useful for content that renders its own keyboard control.`,
  text:	`The user agent should display a virtual keyboard capable of text input in the user's locale.`,
  tel:	`The user agent should display a virtual keyboard capable of telephone number input. This should including keys for the digits 0 to 9, the "#" character, and the "*" character. In some locales, this can also include alphabetic mnemonic labels (e.g., in the US, the key labeled "2" is historically also labeled with the letters A, B, and C).`,
  url:	`The user agent should display a virtual keyboard capable of text input in the user's locale, with keys for aiding in the input of URLs, such as that for the "/" and "." characters and for quick input of strings commonly found in domain names such as "www." or ".com".`,
  email:	`The user agent should display a virtual keyboard capable of text input in the user's locale, with keys for aiding in the input of email addresses, such as that for the "@" character and the "." character.`,
  numeric:	`The user agent should display a virtual keyboard capable of numeric input. This keyword is useful for PIN entry.`,
  decimal:	`The user agent should display a virtual keyboard capable of fractional numeric input. Numeric keys and the format separator for the locale should be shown.`,
  search:	`The user agent should display a virtual keyboard optimized for search.`
}

              
            
!
999px

Console