Source Code

<div class="bento">
  <div class="cell a">
    <div class="icon">✦</div>
    <h3>Build faster</h3>
    <p>Ship production-ready components in minutes, not hours.</p>
  </div>
  <div class="cell b"><div class="big-number">99%</div><span>Satisfaction</span></div>
  <div class="cell c"><div class="icon">⚡</div><h3>Performance</h3></div>
  <div class="cell d"><div class="icon">🎨</div><h3>Design tokens</h3><p>Consistent colors, spacing, and typography.</p></div>
  <div class="cell e"><div class="stat">12k+</div><span>Components</span></div>
  <div class="cell f"><div class="icon">🔒</div><h3>Accessible</h3><p>WCAG 2.1 AA by default.</p></div>
</div>

Bento Grid — Free HTML CSS Dark Layout Snippet

Bento Grid · Layouts · Plain HTML & CSS · Live preview

What's included

Features

repeat(3, 1fr) three-column grid with gap: 10px
grid-column: span 2 on named cells creates the varied bento proportions
Single-letter class modifiers (.a, .b, .d, .e) for span and gradient overrides
Dark base: #0f172a background, #1e293b cell surface, rgba border
Hover: translateY(-2px) lift + accent border-color transition
Gradient accent cells with different backgrounds to anchor visual hierarchy
Large stat number cells: .big-number and .stat typography
Pure HTML and CSS — no JavaScript required
Export as HTML file, React JSX, or React + Tailwind CSS
Live split-pane editor — preview updates as you type

About this UI Snippet

Bento Grid — grid-column span, Named Areas & Dark Feature Layout

Screenshot of the Bento Grid snippet rendered live

The bento grid is a modern layout pattern borrowed from Japanese bento boxes — a collection of different-sized cells arranged in a grid, each containing distinct content. Made popular by Apple and Linear, it is used on feature pages — alongside feature cards and a metric card grid — to showcase product capabilities where each feature gets a proportional amount of visual space based on its importance.

The grid structure

.bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px } creates a three-equal-column grid. Cells span different numbers of columns using grid-column: span N: .a { grid-column: span 2 } makes the first cell take two columns and the next cell one, creating a 2+1 row. .d { grid-column: span 2 } in the second row creates a mirrored 1+2 layout. This combination produces the visually varied bento pattern.

Named cell classes

The cells use single-letter class names (.a, .b, .c, .d, .e) as span modifiers. Most cells use the default .cell background (#1e293b). Cells .a and .e use their own gradient backgrounds to create accent points of visual interest.

The hover interaction

.cell:hover { transform: translateY(-2px); border-color: rgba(99,102,241,0.3); } lifts each cell and tints its border with the accent colour on hover. The transition: transform 0.2s, border-color 0.2s makes both smooth. The default border is rgba(255,255,255,0.06) — nearly invisible on dark background.

Content patterns

The snippet demonstrates four content patterns: emoji icon + heading + description (standard feature cell), large stat number + label (metric cell), and pure gradient accent cells. These four patterns cover most feature grid use cases.

Making it responsive

For mobile, override the grid to a single column: @media (max-width: 640px) { .bento { grid-template-columns: 1fr; } .a, .d { grid-column: span 1; } }. All cells stack vertically on narrow screens.

The grid-column: span pattern

Bento grid items use grid-column: span 2 to occupy two columns of width while using the standard row height. Some items use grid-row: span 2 for double-height cells. The container uses display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px. The browser automatically positions items in the available cells following the normal document flow, wrapping to new rows as needed — for a uniform-cell variant, use the responsive card grid. No manual row/column placement is required — the span values create the varied layout automatically.

Responsive adaptation

On narrow screens, reduce the grid columns: @media (max-width: 768px) { .bento { grid-template-columns: repeat(2, 1fr); } }. Items with span 2 that were wide on desktop now span both narrow columns, becoming full-width. For mobile, single column with no spans works best. Each breakpoint may need custom span overrides for specific items.

The hover accent border

Each bento card uses border: 1px solid transparent initially. On :hover, border-color transitions to the accent colour. Combined with border-radius and the card background, this creates a lit border effect that highlights the card being hovered without moving it. Add box-shadow: 0 8px 32px rgba(accent, 0.1) on hover for additional lift.

Build with AI

Build, Understand, Optimize, and Extend It With AI

You don't have to work out every span value by trial and error here. Paste this snippet's HTML and CSS into an AI coding assistant like Claude and ask it to explain exactly how the three-column repeat(3, 1fr) track combines with grid-column: span 2 on cells a and d to produce the asymmetric 2+1 and 1+2 row pattern, and why the browser's auto-placement algorithm is enough without any explicit grid-row assignments. The same assistant can help optimize it — asking whether the hover lift and border-color transition should be consolidated into a single transition shorthand, or whether the gradient cells should use CSS custom properties so a brand recolor only touches one place. It's also useful for extending the layout: ask it to add a responsive breakpoint that collapses spans on mobile, a cell that spans two rows for a taller feature tile, or a variant with an image-backed cell using object-fit cover. Treat the code less like a finished artifact and more like a starting point for a conversation.

Prompt to recreate it

Copy this into your AI assistant of choice to build the effect from scratch, or as a jumping-off point for your own variant:

text
Build a "bento grid" feature layout in plain HTML and CSS only — no JavaScript, no grid template areas, using only grid-column span values and the browser's automatic item placement.

Requirements:
- A container using display: grid with exactly three equal-width columns (repeat(3, 1fr)) and a consistent gap.
- At least six cells, where two specific cells each use grid-column: span 2 so they occupy two of the three columns while sibling cells fill the remaining single column, producing a visually varied 2-then-1 and 1-then-2 row rhythm purely from the browser's auto-placement — no manual grid-row or grid-column-start values anywhere.
- At least two cells with distinct linear-gradient backgrounds to serve as visual anchor points, while the rest share a common flat dark card background.
- Every cell must have a hover state that lifts it slightly with a transform: translateY and simultaneously brightens its border-color, both animated with a CSS transition, without affecting sibling cells' layout position.
- Include at least three distinct content patterns inside cells: an icon-plus-heading-plus-paragraph cell, a large-number-plus-label stat cell, and an icon-plus-heading-only cell with no paragraph.
- Add a mobile media query that collapses the grid to a single column and resets both span-2 cells back to span 1 so the layout stacks cleanly on narrow screens.

Want to tighten it up first? Run this prompt through the AI Prompt Studio to score it across 8 quality dimensions, catch anti-patterns, and tune the wording for Claude, ChatGPT, or Gemini before you paste it in.

Step by step

How to Use

  1. 1
    Load the snippetClick "Bento Grid" in the sidebar. The preview shows the dark five-cell grid with span-2 cells and gradient accent areas.
  2. 2
    Edit cell contentIn the HTML panel, update the emoji icon, h3 heading, and p description in each .cell div. Change the stat numbers in the metric cells.
  3. 3
    Change the span layoutIn the CSS panel, update grid-column: span 2 on .a and .d to span 1 or span 3 to change the cell proportions.
  4. 4
    Change accent cell gradientsUpdate the linear-gradient on .a and .e cells to your brand colours.
  5. 5
    Make it responsiveAdd @media (max-width: 640px) { .bento { grid-template-columns: 1fr; } .a, .d { grid-column: span 1; } } in the CSS panel.
  6. 6
    Export in your formatClick "HTML" for a standalone file, "JSX" for a React component, or "Tailwind" for a React + Tailwind version.

Real-world uses

Common Use Cases

Product feature showcase sections
Arrange 5–7 product features in a bento grid. The varied cell sizes signal which features are primary. Use gradient accent cells for the most important ones.
Landing page above-the-fold grids
Replace a traditional hero with a bento grid that previews the product. Each cell shows a feature screenshot, metric, or short description.
Stats and metric dashboards
Use the metric cell pattern (large number + label) to display KPIs, user counts, or performance figures in a visual grid.
Learn grid-column span patterns
Edit the span values on .a and .d in the CSS panel. Change span 2 to span 1 or span 3 to understand how span values reshape the grid layout.
Portfolio and case study layouts
Use a bento grid to showcase portfolio work. Each cell becomes a project thumbnail with title. The varied proportions make the grid more visually interesting than a uniform card grid.
Drop into any dark-themed product
The dark colour palette (0f172a/1e293b) matches Next.js, Vercel, and Linear aesthetics. Paste directly into any dark product page.
Related: Code Snippet Tabs
See the Code Snippet Tabs for a related layouts pattern worth pairing with this one.
Related: Sync-Scroll Comparison Layout
See the Sync-Scroll Comparison Layout for a related layouts pattern worth pairing with this one.

Got questions?

Frequently Asked Questions

A bento grid is a CSS Grid layout where cells have varied sizes — some span one column, others span two — creating a visually asymmetric arrangement. It is named after the Japanese bento box and popularised by Apple product pages and SaaS landing pages.

grid-column: span 2 tells a grid item to occupy two consecutive column tracks. In a three-column grid, a span-2 item takes up 2/3 of the row width. The next item (span 1) fills the remaining 1/3, creating a 2+1 layout.

Add a new <div class="cell"> inside .bento. The grid auto-places it in the next available position. To control its position, add a span modifier. For a full-width cell, add .f { grid-column: span 3 } in the CSS.

Add @media (max-width: 640px) { .bento { grid-template-columns: 1fr; } .a, .d { grid-column: span 1; } }. This collapses to a single column on mobile and resets all span overrides.

Yes. Add an img inside any cell with width: 100%; height: auto; object-fit: cover; border-radius: 8px. For cells that should show only an image, remove the text content and set a fixed height on the cell.

Yes. Click "JSX" or "Tailwind" to download the export. In Tailwind, the grid maps to grid grid-cols-3 gap-2.5. span 2 cells use col-span-2. The dark background cells use bg-slate-800 and hover styles use hover:translate-y-[-2px] hover:border-indigo-500/30.