Simple Grid

SimpleGrid uses CSS Grid to create customizable grids. Use --cols to change the number of columns created by SimpleGrid.


Simple, Elegant, and Customizable Grid

Create flexible grids with ease. Just use the [--cols] variable to specify the number of columns you want.

index.html
<!-- 2 Columns -->
<div class="SimpleGrid [--cols:2]">
<div>...</div>
<div>...</div>
</div>
<!-- 3 Columns -->
<div class="SimpleGrid [--cols:3]">
<div>...</div>
<div>...</div>
<div>...</div>
</div>

Children can span any number of columns

Just change the --span variable to change the number of columns a child spans. All children span 1 column by default.

index.html
<div class="SimpleGrid [--cols:6]">
<div>...</div>
<div class="[--span:2]">...</div>
<div class="[--span:3]">...</div>
</div>

Automatically flows to the next row just like you would expect

If the child exceeds the number of columns, it will automatically flow to the next row.

index.html
<div class="SimpleGrid [--cols:6]">
<div>...</div>
<div class="[--span:2]">...</div>
<div class="[--span:4]">...</div>
<div class="[--span:2]">...</div>
<div>...</div>
</div>

Dense supported

Use dense if you wish to fill up spaces with smaller items that come afterwards.

index.html
<div class="SimpleGrid [--cols:6] dense">
<div>...</div>
<div class="[--span:2]">...</div>
<div class="[--span:4]">...</div>
<div class="[--span:2]">...</div>
<div>...</div>
</div>

Responsive grids are super easy

You can use Tailwind responsive modifiers to update --cols and --span on the fly to make any responsive grid you want!

index.html
<div class="SimpleGrid md:[--cols:2] lg:[--cols:3]">
<div>...</div>
<div>...</div>
<div>...</div>
<div>...</div>
<div>...</div>
<div>...</div>
</div>
Resize to see this work!

No minmax nonsense

CSS Grids are notorious to get right because you need minmax(0, <insert-value-here>) or your grid items will overflow.

No such nonsesne here. SimpleGrid takes care of this for you.

Resize to see this work!