Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <ul class="list-cat iz-tags-list filter-button-group">
  <li data-filter="*" class="active">All</li>
  <li data-filter=".web">Web</li>
  <li data-filter=".applications">Applications</li>
  <li data-filter=".motion">Motion</li>
  <li data-filter=".tilda">Tilda</li>
  <li data-filter=".graphic-design">Graphic&nbsp;Design</li>
</ul>

<ul class="list-portfolio grid">
  <li class="p-item web">
    <span class="p-content">
      <span class="p-cat">Web</span>
      <span class="p-title">Title 1</span>
    </span>
  </li>
  <li class="p-item applications">
    <span class="p-content">
      <span class="p-cat">Applications</span>
      <span class="p-title">Title 2</span>
    </span>
  </li>
  <li class="p-item motion">
    <span class="p-content">
      <span class="p-cat">Motion</span>
      <span class="p-title">Title 3</span>
    </span>
  </li>
  <li class="p-item tilda">
    <span class="p-content">
      <span class="p-cat">Tilda</span>
      <span class="p-title">Title 4</span>
    </span>
  </li>
  <li class="p-item web">
    <span class="p-content">
      <span class="p-cat">Web</span>
      <span class="p-title">Title 5</span>
    </span>
  </li>
  <li class="p-item tilda">
    <span class="p-content">
      <span class="p-cat">Tilda</span>
      <span class="p-title">Title 6</span>
    </span>
  </li>
  <li class="p-item web">
    <span class="p-content">
      <span class="p-cat">Web</span>
      <span class="p-title">Title 7</span>
    </span>
  </li>
  <li class="p-item applications">
    <span class="p-content">
      <span class="p-cat">Applications</span>
      <span class="p-title">Title 8</span>
    </span>
  </li>
  <li class="p-item motion">
    <span class="p-content">
      <span class="p-cat">Motion</span>
      <span class="p-title">Title 9</span>
    </span>
  </li>
  <li class="p-item applications">
    <span class="p-content">
      <span class="p-cat">Applications</span>
      <span class="p-title">Title 10</span>
    </span>
  </li>
  <li class="p-item web">
    <span class="p-content">
      <span class="p-cat">Web</span>
      <span class="p-title">Title 11</span>
    </span>
  </li>
  <li class="p-item applications">
    <span class="p-content">
      <span class="p-cat">Applications</span>
      <span class="p-title">Title 12</span>
    </span>
  </li>
  <li class="p-item graphic-design">
    <span class="p-content">
      <span class="p-cat">Graphic&nbsp;Design</span>
      <span class="p-title">Title 13</span>
    </span>
  </li>
  <li class="p-item motion">
    <span class="p-content">
      <span class="p-cat">Motion</span>
      <span class="p-title">Title 14</span>
    </span>
  </li>
  <li class="p-item tilda">
    <span class="p-content">
      <span class="p-cat">Tilda</span>
      <span class="p-title">Title 15</span>
    </span>
  </li>
  <li class="p-item web">
    <span class="p-content">
      <span class="p-cat">Web</span>
      <span class="p-title">Title 16</span>
    </span>
  </li>
  <li class="p-item web">
    <span class="p-content">
      <span class="p-cat">Web</span>
      <span class="p-title">Title 17</span>
    </span>
  </li>
  <li class="p-item graphic-design">
    <span class="p-content">
      <span class="p-cat">Graphic&nbsp;Design</span>
      <span class="p-title">Title 18</span>
    </span>
  </li>
  <li class="p-item motion">
    <span class="p-content">
      <span class="p-cat">Motion</span>
      <span class="p-title">Title 19</span>
    </span>
  </li>
  <li class="p-item graphic-design">
    <span class="p-content">
      <span class="p-cat">Graphic&nbsp;Design</span>
      <span class="p-title">Title 20</span>
    </span>
  </li>
</ul>
              
            
!

CSS

              
                .list-cat {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 20px;
  margin-top: 20px;
}
.list-cat li {
  margin: 5px;
  padding: 10px 20px;
  background: blue;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}
.list-portfolio {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-wrap: wrap;
  width: 900px;
  max-width: 100%;
}
.list-portfolio li {
  display: flex;
  width: 100px;
  height: 100px;
  align-items: center;
  justify-content: center;
  background: red;
  color: #fff;
  margin: 4px;
}
.p-cat {
  position: absolute;
  left: 5px;
  top: 5px;
  font-size: 12px;
}
              
            
!

JS

              
                (function ($) {
  $(window).on("load", function () {
    function getHashFilter() {
      // get filter=filterName
      var matches = location.hash.match(/filter=([^&]+)/i);
      var hashFilter = matches && matches[1];
      return hashFilter && decodeURIComponent(hashFilter);
    }

    // init Isotope
    var $grid = $(".grid");
    // bind filter button click
    var $filterButtonGroup = $(".list-cat");

    // filter items on button click
    $(".list-cat").on("click", "li", function () {
      var filterValue = $(this).attr("data-filter");
      $grid.isotope({ filter: filterValue });
      // set filter in hash
      location.hash = "filter=" + encodeURIComponent(filterValue);
      // check active item tag
      $(this).addClass("active").siblings().removeClass("active");
    });

    var isIsotopeInit = false;

    function onHashchange() {
      var hashFilter = getHashFilter();
      if (!hashFilter && isIsotopeInit) {
        return;
      }
      isIsotopeInit = true;

      // filter isotope
      $grid.isotope({
        itemSelector: ".p-item",
        layoutMode: "fitRows",
        fitRows: {
          gutter: 2
        },

        // use filterFns
        filter: hashFilter
      });

      // set selected class on button
      if (hashFilter) {
        $filterButtonGroup.find(".active").removeClass("active");
        $filterButtonGroup
          .find('[data-filter="' + hashFilter + '"]')
          .addClass("active");
      }
    }

    $(window).on("hashchange", onHashchange);

    // trigger event handler to init Isotope
    onHashchange();
  });
})(jQuery);

              
            
!
999px

Console