By · Updated

Bento Grid CSS Generator

CSS Grid Layout with Spanning Tiles

No ratings yet

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the Bento Grid Builder works

This bento grid CSS generator lets you lay one out by spanning tiles. A bento grid is a dashboard-style layout where tiles of different sizes fit together like compartments in a lunch box. Pick a pattern, tune the gap, row height and corners, and copy a CSS Grid snippet where the spans are already worked out and a mobile breakpoint is included.

A bento grid packs tiles of different sizes into one tidy rectangle, like the compartments of a Japanese lunch box. Apple's product launch slides made it famous around 2022, and it has since become the default layout for SaaS feature sections, portfolio home pages and dashboards. The appeal is hierarchy without chaos: the most important item gets a big tile, supporting items get small ones, and everything still shares the same gutters and edges.

How the bento grid CSS works

Under the look there is nothing exotic, just CSS Grid and a few span rules.

The four patterns

Each pattern fills exactly twelve cells, three full rows of four, so the grid always ends square. Uniform is the exception, with eight single cells in two rows.

Pattern Featured tile Other tiles Good for
Feature left 2 × 2 four 1 × 1, two 2 × 1 Product pages, a hero plus supporting points
Feature top 3 × 1 banner one 1 × 2, one 1 × 1, three 2 × 1 Announcement, then detail
Mosaic 2 × 1 tall, wide and square mixed Editorial pages and portfolios
Uniform none bigger eight 1 × 1 A clean start to place your own spans

The preview labels every tile with its size, such as "2 × 1", so you can see which spans the CSS produced. The first tile in every pattern gets the is-featured class, the accent gradient and a larger heading.

Choosing the numbers

Where it breaks, and how to fix it

Using the code

Copy the HTML and CSS together. The HTML is a <section class="bento"> holding one <article> per tile with an h3 and a p. Replace the placeholder text with your own, and put an icon or screenshot above the heading; tiles align content to the bottom with justify-content: flex-end, so an image sits naturally at the top. If you add tiles beyond the pattern, they become single cells and dense packing fits them in.

For a grid of equal-width columns with items of varying height, use the masonry grid instead. To place tiles by name rather than by span, try the grid areas builder, and for plain rows and columns the CSS grid generator.

FAQ

How do I change which tile is featured?

The featured styling is on the .is-featured class and the size is on .bento-tile:nth-child(1). Move the class to another article and update the nth-child selector to match its position, or replace the nth-child rules with explicit classes such as .span-2 if you prefer to control layout from the markup.

Why do some tiles jump out of order?

That is grid-auto-flow: dense backfilling empty cells with later items. It keeps the grid free of holes but can move a tile visually ahead of one that comes before it in the HTML. Remove the dense keyword if strict source order matters more to you than a gap-free layout.

Can the tiles grow to fit their content?

Yes. Replace the fixed grid-auto-rows value with minmax(120px, auto). Rows will then be at least 120px but stretch when a tile needs more room. The spanning tiles keep their proportions relative to whatever the rows become.

How do I add more tiles?

Append more <article class="bento-tile"> elements. New tiles default to one cell each and flow into the next available slot. Add an nth-child rule with a span if you want any of them to be larger; the grid creates as many rows as it needs.

Does this work without the mobile media query?

It renders, but on a narrow phone four columns become very thin and the featured tile's text will wrap badly. The breakpoint is three lines and it is the difference between a layout that works on mobile and one that only looks good in a desktop screenshot.

See also: all Layout & Spacing tools, Shadows & Motion, Shapes & SVG, UI Components, Forms & Inputs, Colour.

Related tools