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.


                <main class="main" role="main">
	<div class="intro">
		<h1>A basic <code>&lt;datalist&gt;</code> example</h1>
		<p>The following example demonstrates a progressively-enhanced form using the new <a href="">&lt;datalist&gt;</a> form control. In browsers supporting this feature, a single text input will display and suggested values will be shown based on user input.</p>
		<p>For example, in a recent version of Internet Explorer, Firefox, or Chrome, start typing "Ala" into the input. In browsers lacking <code>&lt;datalist&gt;</code> support, a <code>&lt;select&gt;</code> form control will be displayed along with an additional message and text input for supplying an unlisted value.</p>
		<p>As an added bonus, for browsers lacking proper <code>&lt;datalist&gt;</code> support, a bit of JavaScript re-associates the "State" label with the <code>&lt;select&gt;</code> form control and wraps the "If other, please specify:" text in a <code>&lt;label&gt;</code> and associates it with the text input.</p>
		<p>The markup for this example is based on <a href="">Aaron Gustafson's pen</a> which was based on <a href="">Jeremy Keith's blog post</a>.</p>
		<label for="state" id="state-label">State</label>
		<datalist id="states">
			<select name="state" id="state-select" aria-labelledby="state-label">
				<option value="Alabama">Alabama</option> 
				<option value="Alaska">Alaska</option> 
				<option value="Arizona">Arizona</option> 
				<option value="Arkansas">Arkansas</option>

			<p id="other-label">If other, please specify:</p>
		<input type="text" id="state" name="state" list="states">


*:after {
	box-sizing: inherit;

html {
	box-sizing: border-box;

body {
	background: #faebd0;
	font: normal 1.125em/1.7 Georgia, serif;
	margin: 0;
	padding: 1em;

.main {
	margin: 0 auto;
	max-width: 40em;

h1 {
	font-size: 2em;
	font-weight: normal;
	line-height: 1.1;
	margin: 1em 0;

p {
	margin: 1.5em 0;

a {
  color: #c00;

form {
	border-top: 0.25em solid rgba(#000, 0.1);
	margin: 3em 0;
	padding-top: 3em;

label {
	cursor: pointer;
	display: block;

input {
	font: inherit;

select {
	display: block;
	margin-bottom: 1.5em;
	width: 100%;

form p {
	margin: 0;

input {
	border: 2px solid rgba(#000, 0.25);
	border-radius: 0.25em;
	display: block;
	padding: 0.5em;
	width: 100%;


                (function() {
	if (!('list' in document.createElement('input'))) {
		var stateLabel = document.getElementById('state-label'),
			 otherLabel = document.getElementById('other-label');
		stateLabel.setAttribute('for', 'state-select');
		otherLabel.innerHTML = '<label for="state">' + otherLabel.innerText + '</label>';