All effectsVisual styles

Bento Grid

便当盒网格

Tiles of different sizes share an aligned grid and consistent gaps.

Look at how the large and small tiles align

Where to use it

Give related product features or dashboard summaries different emphasis. Assign the largest tile to the information readers should act on first, then put supporting details in smaller tiles.

Practical example

A weekly household budget puts the remaining spending allowance in a double-height tile. Smaller neighboring tiles show the next bill and spending by category, and all three stack in reading order on a phone.

AI prompt

Lay out [target cards] in a Bento Grid. Use CSS Grid with a larger lead tile spanning two rows and smaller tiles on the side. Align the gutters, preserve logical reading order, and collapse to one column on narrow screens.

Example code

Save the standalone HTML as a file and open it in your browser. It uses the same code as the preview.

View HTML
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Bento Grid</title>
  <style>
    :root {
      color-scheme: dark;
      --demo-bg: #171629;
      --demo-ink: #f8f5ff;
      --demo-accent: #b9a6ff;
      --demo-muted: #bfbbd3;
      font-family: system-ui, sans-serif;
      color: var(--demo-ink);
      background: var(--demo-bg);
    }

    *, *::before, *::after { box-sizing: border-box; }
    body { margin: 0; min-width: 0; }
    button, input { font: inherit; }

    .demo {
      display: grid;
      place-items: center;
      align-content: center;
      min-height: 100vh;
      padding: 14px;
      overflow: hidden;
      background: radial-gradient(ellipse at 50% 24%, #28233f, var(--demo-bg) 78%);
    }

    .demo-button {
      border: 1px solid #ffffff3d;
      border-radius: 7px;
      background: #ffffff12;
      color: var(--demo-ink);
      padding: 6px 11px;
      font-size: 12px;
      cursor: pointer;
    }

    :focus-visible {
      outline: 2px solid var(--demo-accent);
      outline-offset: 3px;
    }

    .visual-specimen {
      width: min(100%, 290px);
      height: 124px;
      display: grid;
      place-items: center;
      position: relative;
      isolation: isolate;
    }
    .bento { display: grid; grid-template-columns: 1.25fr 1fr; grid-template-rows: repeat(2, 48px); gap: 5px; width: min(100%, 211px); }
    .bento > div { display: grid; gap: 3px; align-content: center; justify-items: start; padding: 9px; border-radius: 9px; font-size: 10px; }
    .bento-lead { grid-row: span 2; background: #9b8ac7; color: #291c45; }
    .bento-lead i { width: 35px; aspect-ratio: 1; border-radius: 50%; background: conic-gradient(#f5d8f1 0 61%, #5a4b87 61%); }
    .bento-trend { background: #96d4bd; color: #183d37; }
    .bento-trend i { width: 30px; height: 10px; clip-path: polygon(0 87%, 34% 35%, 54% 58%, 98% 0, 100% 20%, 55% 83%, 35% 58%, 0 100%); background: currentColor; }
    .bento-team { background: #f4cc82; color: #553813; }
    .bento-team i { width: 10px; aspect-ratio: 1; border-radius: 50%; background: currentColor; box-shadow: 9px 0 #8b5627, 18px 0 #b3783a; }
  </style>
</head>
<body>
  <main class="demo">
    <div class="visual-specimen" aria-hidden="true"><div class="bento"><div class="bento-lead"><i></i><b>Overview</b></div><div class="bento-trend"><i></i><b>Trends</b></div><div class="bento-team"><i></i><b>Team</b></div></div></div>
  </main>
</body>
</html>

Original example by UI Skills