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


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.


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.


	<h1>Different ways to call (or not call) <code>classList.remove()</code></h1>
	<p>Each of these boxes starts with 3 classes defining different background colors. If our call to <code>classList.remove()</code> works, it should fall back to a simple gray color. Otherwise, it will either display yellow, green, or blue.</p>
	<p>Open your DevTools to see how each either succeeds or fails depending on the syntax and browser.</p>

	<h2>Fails because "invalid characters"</h2>
	<code><pre>// 😭 "Invalid characters" / can't include spaces
thing1.classList.remove('class1 class2 class3');</pre></code>
	<div id="thing1" class="class1 class2 class3"></div>

	<h2>Works in modern browsers (not IE)</h2>
	<code><pre>// 😎 Modern
thing2.classList.remove('class1', 'class2', 'class3');</pre></code>
	<p class="warning"><strong>Warning</strong>: Doesn't work in Internet Explorer.</p>
	<div id="thing2" class="class1 class2 class3"></div>

	<h2>Works in Internet Explorer</h2>
	<code><pre>// 🤓 Internet Explorer
	<div id="thing3" class="class1 class2 class3"></div>
		<li><a href="" target="_blank" rel="noopener">MDN: Element.classList</a></li>



                /* ------------------------------ */
/* Base                           */
/* ------------------------------ */

html {
	box-sizing: border-box;

::before {
	box-sizing: inherit;

body {
	margin: 1rem auto 3rem;
	line-height: 1.4;
	tab-size: 4;

main {
	display: block; /* Fix IE rendering main as inline */
	margin: 0 auto;
	max-width: 38rem;
	padding-left: 1rem;
	padding-right: 1rem;

pre {
	border: 1px solid #ccc;
	padding: 1rem;
	overflow: auto;
	-webkit-overflow-scroll: touch;

.warning {
	color: red;
	font-size: 0.8rem;

/* ------------------------------ */
/* Demo                           */
/* ------------------------------ */

div { width: 100px; height: 100px; }
div { background: gray; }

.class1 { background: yellow; }
.class2 { background: green; }
.class1 { background: blue; }



                // 😭 "Invalid characters" / can't include spaces
try {
	thing1.classList.remove('class1 class2 class3');
} catch (err) {

// 😎 Modern
thing2.classList.remove('class1', 'class2', 'class3');

// 🤓 Internet Explorer