body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
background: #0c0d10;
color: #eceef2;
font: 14px/1.45 system-ui, sans-serif;
}
.bento-wrap {
width: min(720px, 100% - 32px);
container-type: inline-size;
}
.bento {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-auto-rows: 140px;
gap: 10px;
}
.tile {
display: flex;
flex-direction: column;
padding: 18px;
overflow: hidden;
border: 1px solid #23252c;
border-radius: 18px;
background: linear-gradient(180deg, #17181d, #121317);
}
.tile--hero { grid-column: span 2; grid-row: span 2; background: radial-gradient(circle at 80% 0%, #2a2350, #121317 60%); }
.tile--team { grid-column: span 2; }
.tile--chart { grid-column: span 1; }
.tile--code { grid-column: span 1; }
.tile__label {
margin: 0;
color: #8f929d;
font-size: 0.8rem;
}
.tile__stat {
margin: auto 0 4px;
font-size: clamp(2.4rem, 9cqi, 3.6rem);
font-weight: 700;
letter-spacing: -0.04em;
}
.tile__text {
margin: 0;
color: #a3a6b1;
}
.avatars {
display: flex;
margin-top: auto;
}
.avatars span {
display: grid;
place-items: center;
width: 44px;
height: 44px;
margin-left: -10px;
border: 3px solid #15161b;
border-radius: 50%;
background: #3b3f4a;
font-size: 0.78rem;
font-weight: 700;
}
.avatars span:first-child { margin-left: 0; background: #6d5cff; }
.avatars span:nth-child(2) { background: #0ea5e9; }
.avatars span:nth-child(3) { background: #f97316; }
.spark {
display: flex;
align-items: flex-end;
gap: 4px;
height: 100%;
margin-top: 10px;
}
.spark i {
flex: 1;
height: var(--h);
border-radius: 3px;
background: #a78bfa;
}
.tile--code pre {
margin: auto 0 0;
color: #b9f5c9;
font: 11px/1.6 ui-monospace, monospace;
white-space: pre-wrap;
}
@container (max-width: 560px) {
.bento {
grid-template-columns: repeat(2, 1fr);
}
.tile--hero,
.tile--team {
grid-column: span 2;
}
.tile--hero {
grid-row: span 1;
}
}How to use it
Tiles span columns and rows with
grid-column and grid-row. The grid responds to the width of .bento, not the viewport, so it also works inside sidebars and modals.