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.


   <div id="buttonContainer">
      <div class="btn" data-filter="One">Uno</div>
      <div class="btn" data-filter="Two">Dos</div>
      <div class="btn" data-filter="Three">Tres</div>
      <div class="btn"data-filter="Four">Cuatro</div>
      <div class="btn" data-filter="Five">Cinco</div>
      <div class="btn" data-filter="Six">Seis</div>
      <div class="btn" data-filter="Seven">Siete</div>
      <div class="btn" data-filter="Eight">Ocho</div>
      <div class="btn" data-filter="Nine">Nueve</div>
      <div class="btn" data-filter="Ten">Diez</div>
      <div class="btn" data-filter="Eleven">Once</div>
      <div class="btn" data-filter="Twelve">Dose</div>
   <div id="output">


                body {
   background-color: #444;
   color: white;
   padding: 20px;

#output {
   border: 1px solid white;
   margin: 2px;
   padding: 10px;

#buttonContainer {
   display: flex;
   justify-content: space-between;

.btn {
   flex: 0 1 auto;
   width: 8%;
   box-sizing: border-box;
   height: 30px;
   padding-top: 3px;
   text-align: center;
   background-color: #aaa;
   color: black;
   cursor: pointer;

#buttonContainer > div:hover {
   border-bottom: 4px solid teal;


                /* inspired by:

$(document).ready(function () {
   // cache DOM elements
   var buttonContainer = $("#buttonContainer"),
       output = $("#output");
   // assign event handler to PARENT element
   buttonContainer.on("click", clickHandler);
   // handle clicks to CHILD elements using
   // ('e' is the whole event object).
   // is what you clicked on.
   // e.currentTarget is the element that the event
   // listener is attached to (buttonContainer).
   function clickHandler(e) {
      // to ignore clicks on parent element, only run code
      // if the clicked element != the event listener target
      if ( !== e.currentTarget) {
         var filterString =;
         // console.log(e);  // diag
         console.log("Element attribute: " + filterString);  // diag
         // update DOM
            .find("p")  // target the <p> within <div id="output">
      // finally, prevent the event bubbling further up DOM