# Dense Bento Grid

> A bento grid of wide, tall and big tiles that backfills empty holes with grid-auto-flow: dense.

- Category: [CSS Layouts](https://copy-css.com/category/layouts)
- Tags: bento, grid-auto-flow, dense, span, gallery, no gaps
- Live preview: https://copy-css.com/snippets/dense-bento-grid
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="bento-dense">
  <div class="bento-dense-wide"></div>
  <div></div>
  <div class="bento-dense-tall"></div>
  <div></div>
  <div class="bento-dense-big"></div>
  <div></div>
  <div></div>
  <div class="bento-dense-wide"></div>
  <div></div>
</div>
```

## CSS

```css
.bento-dense {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  grid-auto-rows: 120px;
  grid-auto-flow: dense; /* later small tiles fill earlier holes */
  gap: 12px;
}

.bento-dense-wide {
  grid-column: span 2;
}

.bento-dense-tall {
  grid-row: span 2;
}

.bento-dense-big {
  grid-column: span 2;
  grid-row: span 2;
}
```

## Notes

- This CSS Dense Bento Grid is 20 lines of pure CSS (0.3 KB) with no JavaScript and no dependencies. It uses CSS Grid.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
