css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <div class="formWrap">
 <!-- I think autofocus doesn't work on codepen because the editors grab focus? -->
    <input type="text" placeholder="placeholder" />
<!-- I am removing the "autofocus" because while codepen grabs the focus here in the site - when you embed pens it DOES grab focus over there... and being on a long blog post it kept forcing my page down to this embedded pen. -->
    <input type="text" autocomplete="on"/>
    <label>Pattern (Three Numbers)</label> <!-- regex [A-Z] - title adds a hint to user on submit -->
    <input type="text" required pattern="[0-9]{3}" title="3 Numbers Please"/>
<!-- triggers validation -->
    <input type="submit" value="Submit">
<div class="formWrap">
  <form novalidate>
    <label>'novalidate' on form</label>
    <input type="text" placeholder="Is required but..." required />
    <input type="submit" value="No Validate">
    <p>"novalidate" on the form element overrides all required attributes. </p>
    <label>'formnovalidate' on Save Draft</label>
    <input type="text" placeholder="Is required but..." required />
    <input class="half" type="submit" value="Save Draft" formnovalidate>
    <input class="half" type="submit" value="Update">
    <p>"formnovalidate" on a button allows validation for one while the other submits. Use case here is saving a draft.</p>

<div class="formWrap">
<label for="yourlang">Datalist - uses the js above:</label>
  <input type="text" name="yourlang" id="yourlang" list="language">
  <datalist id="language">
    <option value="Python">
    <option value="C#">
    <option value="Java">
    <option value="Javascript">
    <option value="HTML">
    <option value="SASS-CSS">
    <option value="PHP">
    <option value="Machine Code">
    <option value="SVG">
    <option value="Another">
    <input class="sm-text" type="email" list="emails" multiple>
    <datalist id="emails">
        <option value="first@example.com">
        <option value="second@example.com">
        <option value="third@example.com">
        <option value="last@example.com">
    <p>Choose from select, then press 'comma' key and choose again. Not very intuitive, but can be tightened up.</p>
<div class="formWrap">
  <label>Multiple Upload files:</label>
   <input class="sm-text" type="file" multiple name="upload">
   <input class="half" type="submit" value="Upload">
 <p>Multiple doesn't seem to have much support yet (<a href="http://caniuse.com/#feat=input-file-multiple">though it should</a>) They both have strange user experience, but with some scripting you could really tighten it up.</p>
<!-- <hr>
  <p>placeholder, :autofocus, autocomplete, required, pattern.
    list, multiple, novalidate, formnovalidate, form.
    formaction, formenctype, formmethod, formtarget</p> -->

              $pri: #444;
$pri-light: lighten($pri, 20%);
$pri-x-light: lighten($pri, 40%);
$pri-med: darken($pri, 10%);
$pri-dark: darken($pri, 20%);
$pri-x-dark: darken($pri, 30%);
::-webkit-input-placeholder { color: $pri-light; }
::-moz-placeholder { /* Firefox 19+ */ color: $pri-light; }
:-ms-input-placeholder { color: $pri-light; }
:-moz-placeholder { /* Firefox 18- */ color: $pri-light; }

* { box-sizing: border-box; }
html {
  font-family: helvetica;
  font-size: 16px;
body {
  background-color: $pri;
hr { 
  border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.75), rgba(255, 255,255, 0));
p, p a {
  font-size: 1.1em;
  line-height: 1.3em;
  margin: .3em;
  color: $pri-x-light;
.formWrap {
  width: 20em;
  margin: 1em;
  float: left;
label {
  padding-bottom: .3em;
  font-size: .85em;
  display: block;
  color: $pri-x-light;
input {
  font-size: 1.6em;
  margin: 0 .3em .3em 0;
  padding: .3em;
  width: 100%;
  border-radius: .25em;
  border: 3px solid $pri-light;
  background-color: #f2f2f2;
  &.sm-text { font-size:.7em; padding: 1em;  }
input[type=submit] {
  box-sizing: border-box;
  background-color: $pri-med;
  font-size: 1.6em;
  width: 100%;
  &.half { width: 49%; font-size: 1.3em; margin: 0; }
  padding: .3em;
  color: #fff;
  border-radius: .25em;
  border: 3px solid  $pri-light;
  &:first-of-type { margin-left: 0; }
  &:hover { 
    border-color: $pri-dark;
    background-color: $pri-med;
  &:active { 
    box-shadow: inset 0 0 20px $pri-x-dark;
    background-color: $pri-med; }
  &:focus { outline: 0; }
              // Credit: Jeremy Keith
// https://gist.github.com/adactio/3332444
// I just wanted a quick reference for myself
// I made a pen here for this alone: https://codepen.io/peterdillon/pen/MaovZd
(function(win,doc) {
	if (doc.querySelectorAll) {
		var inputs = doc.querySelectorAll('input[list]'),
			  total = inputs.length;
		for (var i=0; i<total; i++) {
			var input = inputs[i],
				id = input.getAttribute('list'),
				list = doc.getElementById(id),
				options = list.getElementsByTagName('option'),
				amount = options.length,
				//rand = Math.floor(Math.random()*amount),
				// option = options[rand],
				value = option.getAttribute('value');
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................