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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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>Indeterminate Checkboxes</h1>
		<input type="checkbox" name="tall" id="tall">
		<label for="tall">Tall Things</label>
				<input type="checkbox" name="tall-1" id="tall-1">
				<label for="tall-1">Buildings</label>
				<input type="checkbox" name="tall-2" id="tall-2">
				<label for="tall-2">Giants</label>

						<input type="checkbox" name="tall-2-1" id="tall-2-1">
						<label for="tall-2-1">Andre</label>
						<input type="checkbox" name="tall-2-2" id="tall-2-2">
						<label for="tall-2-2">Paul Bunyan</label>
				<input type="checkbox" name="tall-3" id="tall-3">
				<label for="tall-3">Two sandwiches</label>
		<input type="checkbox" name="short" id="short">
		<label for="short">Short Things</label>

				<input type="checkbox" name="short-1" id="short-1">
				<label for="short-1">Smurfs</label>
				<input type="checkbox" name="short-2" id="short-2">
				<label for="short-2">Mushrooms</label>
				<input type="checkbox" name="short-3" id="short-3">
				<label for="short-3">One Sandwich</label>

<p>Based on <a href="" target="_blank">this pen</a> by <a href="" target="_blank">
	Chris Coyier</a></p>



                body {
  padding: 20px;
ul { 
  list-style: none;
  margin: 5px 20px;
li {
  margin: 10px 0;

p { font-size: 12px; margin: 24px;}


                //	helper function to create nodeArrays (not collections)
const nodeArray = (selector, parent=document) => [];

//	checkboxes of interest 
const allThings = nodeArray('input');

//	global listener
addEventListener('change', e => {
	let check =;

	//	exit if change event did not come from 
	//	our list of allThings 
	if(allThings.indexOf(check) === -1) return;

	//	check/unchek children (includes check itself)
	const children = nodeArray('input', check.parentNode);
	children.forEach(child => child.checked = check.checked);
	//	traverse up from target check
		//	find parent and sibling checkboxes (quick'n'dirty)
		const parent   = (check.closest(['ul']).parentNode).querySelector('input');
		const siblings = nodeArray('input', parent.closest('li').querySelector(['ul']));

		//	get checked state of siblings
		//	are every or some siblings checked (using Boolean as test function) 
		const checkStatus = => check.checked);
		const every  = checkStatus.every(Boolean);
		const some = checkStatus.some(Boolean);		
		//	check parent if all siblings are checked
		//	set indeterminate if not all and not none are checked
		parent.checked = every;		
		parent.indeterminate = !every && every !== some;

		//	prepare for nex loop
		check = check != parent ? parent : 0;

closest polyfill for ie 

if (window.Element && !Element.prototype.closest) {
  Element.prototype.closest =
  function(s) {
    var matches = (this.document || this.ownerDocument).querySelectorAll(s),
        el = this;
    do {
      i = matches.length;
      while (--i >= 0 && matches.item(i) !== el) {};
    } while ((i < 0) && (el = el.parentElement));
    return el;