Get started with packery CDN

GPL-3.0 licensed

Packery is a library for creating efficient, touch-friendly, and customizable grid layouts.

Tags:
  • bin-packing
  • layout
  • float
  • masonry
  • nogaps

Stable version

Copied!

How to start using packery CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with packery CDN - cdnhub.io</title>
  <style>
    .grid {
      display: flex;
      flex-wrap: wrap;
      margin: 0;
      padding: 0;
    }
    .grid-item {
      width: 200px;
      height: 200px;
      background-color: #f1c40f;
      margin: 10px;
      text-align: center;
      line-height: 200px;
      font-size: 2em;
      color: #fff;
    }
  </style>
</head>
<body>
  <div id="grid" class="grid">
    <div class="grid-item">Item 1</div>
    <div class="grid-item">Item 2</div>
    <div class="grid-item">Item 3</div>
    <div class="grid-item">Item 4</div>
    <div class="grid-item">Item 5</div>
  </div>
  <script src="https://cdn.cdnhub.io/packery/2.1.2/packery.pkgd.min.js"></script>
  <script src="https://cdn.cdnhub.io/packery/2.1.2/packery-adapter-jquery.pkgd.min.js"></script>
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script>
    $(function() {
      $('#grid').packery({
        itemSelector: '.grid-item',
        columnWidth: '.grid-item'
      });
    });
  </script>
</body>
</html>
Copied!
Copied!

All versions