---
title: "Masonry"
description: "A masonry grid of mixed-size cells that snaps to any cell."
canonical_url: "https://www.blossom-carousel.com/docs/examples/basic/masonry"
---

> Index of every page on this site: [llms.txt](https://www.blossom-carousel.com/llms.txt)

<example-masonry>



</example-masonry>

<tabs sync="example-code-style">
<tabs-item label="CSS">
<code-group>

```css [.css]
.carousel {
  display: grid;
  grid-auto-columns: 200px;
  grid-template-rows: repeat(3, 1fr);
  grid-auto-flow: column dense;
  gap: 1rem;
  scroll-snap-type: x mandatory;
}

.slide {
  &:nth-child(3n + 2) {
    grid-column: span 2;
  }

  &:nth-child(4n + 1) {
    scroll-snap-align: center;
    background-color: var(--color-primary);
  }

  &:nth-child(1),
  &:nth-child(6),
  &:nth-child(13) {
    grid-row: span 2;
  }
}
```

```html [.html]
<BlossomCarousel class="carousel">
  <div class="slide"></div>
  <div class="slide"></div>
  <div class="slide"></div>
  ...
</BlossomCarousel>
```

</code-group>
</tabs-item>

<tabs-item label="Tailwind">

```html [.html]
<BlossomCarousel
  class="grid! auto-cols-[200px] h-[266px] snap-x snap-mandatory grid-rows-3 grid-flow-col grid-flow-col-dense gap-4"
>
  <div
    class="slide size-full nth-[3n+2]:col-span-2 nth-[4n+1]:snap-center nth-[1]:row-span-2 nth-[6]:row-span-2 nth-[13]:row-span-2"
  >
    1
  </div>
  ...
</BlossomCarousel>
```

</tabs-item>
</tabs>

## Sitemap

See the full [sitemap](https://www.blossom-carousel.com/sitemap.md) for all pages.
