# Twelve Column Grid

> A tiny mobile-first 12-column grid system: everything is full width until the span classes kick in.

- Category: [CSS Layouts](https://copy-css.com/category/layouts)
- Tags: 12 column, grid system, span, bootstrap alternative, mobile first
- Live preview: https://copy-css.com/snippets/twelve-column-grid
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="grid12">
  <div class="grid12-span-12">12</div>
  <div class="grid12-span-6">6</div>
  <div class="grid12-span-6">6</div>
  <div class="grid12-span-4">4</div>
  <div class="grid12-span-4">4</div>
  <div class="grid12-span-4">4</div>
  <div class="grid12-span-8">8</div>
  <div class="grid12-span-4">4</div>
</div>
```

## CSS

```css
.grid12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

/* Mobile first: every item takes the full row */
.grid12 > * {
  grid-column: span 12;
}

@media (min-width: 640px) {
  .grid12 > .grid12-span-3 { grid-column: span 3; }
  .grid12 > .grid12-span-4 { grid-column: span 4; }
  .grid12 > .grid12-span-6 { grid-column: span 6; }
  .grid12 > .grid12-span-8 { grid-column: span 8; }
  .grid12 > .grid12-span-9 { grid-column: span 9; }
}
```

## Notes

- This CSS Twelve Column Grid is 18 lines of pure CSS (0.5 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.
