Layout & Grid snippets

CSS layout snippets: grid, flexbox, centering, positioning, and responsive patterns. Every snippet includes a live demo, copyable CSS, and an LLM-ready prompt.

Widely supported

Aspect-ratio card

Media card with consistent ratio and object-fit.

ui
Widely supported

Auto-responsive card grid

The RAM pattern: repeat(auto-fill, minmax()) for grids that adapt without media queries.

grid
Widely supported

Holy grail layout

The classic holy grail layout with header, two sidebars, content, and footer using CSS Grid template areas.

grid
Widely supported

Media object

The classic media object pattern with image on the left and text on the right using flexbox and object-fit.

Widely supported

Responsive table

A table that stacks into card-like rows on small screens using container queries and data-label attributes.

ui
Widely supported

Sticky footer

A sticky footer that stays at the bottom of the viewport even with short content.

Widely supported

Subgrid layout

Aligned grid children with CSS subgrid — no fixed heights.