The library

Techniques, not templates

Every trick recreated from the source video as a live, self-contained demo. Search, filter, open, steal.

01 / 25

Tabular Nums: The Number Stops Wiggling

Most fonts give every digit its own width: a 1 is narrow, a 0 is wide. So a live timer, price or score walks sideways on every tick. Both cards run off one clock and show the same number at the same moment, so the only thing that differs is the figures the font hands back. On the left the crimson ghosts are where the number's right edge stood on the last fourteen ticks, the band behind them is the spread, and the readout is that spread in pixels, measured off the painted box rather than counted from the string. On the right, font-variant-numeric: tabular-nums gives every digit the same advance, so the ghosts land on one line and the drift reads 0 px. One declaration, in every current browser. It asks the font for its tabular figures, so a font without them cannot do it.

animationcsslayouttypographynumbersfont
02 / 25

Gliding Pill Nav, No Measuring

A pill that follows the pointer without measuring anything. The hovered link takes anchor-name: --pill, and the rail's ::before sets position-anchor: --pill and inset: anchor(top) anchor(right) anchor(bottom) anchor(left), so its four edges are that link's four edges: it becomes the link, wherever the link sits. Transitioning inset turns the jump into a glide. Two elements holding one anchor name is not an error, it is worse: the later one in the DOM quietly wins, so an active link at the end of the rail steals the pill back from anything hovered before it. While the rail has a hovered link, the resting link gives up the name. The rail carries no padding, no gap and square links, because hit testing follows border-radius and any dead pixel hands the pill back mid-glide.

animationcsslayouthoveranchor-positioningnavigation
03 / 25

Even Flex Lines with flex-wrap: balance

Greedy wrapping fills the first line and strands whatever is left, which is how a four-item nav ends up three across with one alone underneath. flex-wrap: balance asks the browser to spread the items evenly over the lines it needs instead — four items become two and two. Drag the panel's right edge to move the wrap point and watch the two lists disagree. Chrome 150 is the first to ship it, so the balanced list falls back to wrap elsewhere and says so.

csslayoutflexboxprogressive enhancementflex-wrap
04 / 25

Stop Layout Jump with scrollbar-gutter

When content grows enough to need a scrollbar, the browser carves that width out of the element and everything inside shifts sideways. scrollbar-gutter: stable reserves the gutter up front, so the scrollbar appears into space that was already set aside and nothing moves. Both panels here gain and lose the same content — only the left one lurches.

csslayoutscrollingscrollbar-gutterlayout shift
05 / 25

Smooth Collapsing Sidebar with Flexbox Fixes

This demo illustrates how to create a collapsing sidebar that transitions smoothly, preventing text labels from wrapping and icons from squashing during the animation. It uses `white-space: nowrap` for labels and `flex-shrink: 0` for icons, combined with width and opacity transitions.

animationcsslayoutflexboxtransitionsidebardashboard
06 / 25

Highlighted Pricing Card

A three-column pricing table where the middle, 'popular' plan stands out with a larger scale, a glowing gradient border, and an accent badge. Numeric figures are aligned using tabular numbers for a clean, consistent look.

csslayouttypographygradientcardpricingtransform
07 / 25

Flexbox Expanding Gallery on Hover

A responsive gallery where hovering over a panel expands it, causing other panels to gracefully shrink. This effect is achieved purely with CSS flexbox and transitions, leveraging the `flex` property.

animationcsslayouthoverflexboxgallery
08 / 25

CSS Grid Bento Layout

This demo illustrates how to create a flexible 'Bento Grid' layout using CSS Grid, where tiles of varying sizes snap together. The core technique involves defining a grid, allowing specific tiles to span multiple columns and rows, and utilizing `grid-auto-flow: dense` to automatically fill any empty spaces.

csslayoutresponsivegridbentodense-packing
09 / 25

Performant CSS Animations: Transform vs. Left

This demo illustrates the performance difference between animating an element's 'left' property and its 'transform: translateX()' property. Animating 'left' forces the browser to re-calculate layout on every frame, leading to a 'janky' or stuttering effect. In contrast, 'transform: translateX()' allows the browser to offload the animation directly to the GPU, skipping layout and paint, resulting in a smooth 60fps animation.

animationcsslayoutperformancetransformgpu
10 / 25

Pure CSS Sticky Header in a Scroll Container

A header that smoothly sticks to the top of its parent scrollable container as content scrolls underneath, achieved purely with CSS position: sticky and without any JavaScript. This snippet demonstrates common pitfalls and correct implementation.

csslayoutscrollstickypositionnojsheader
11 / 25

Readable Line Length with `ch` unit

This trick demonstrates how to improve text readability by limiting line length using the CSS `ch` unit. Long lines make text hard to follow, while `max-width: 65ch` creates an ideal measure for comfortable reading.

csslayoutresponsivetypographyreadability
12 / 25

CSS Text Wrap: Balance & Pretty

This UI trick uses the new `text-wrap` CSS property to intelligently balance headlines and prevent orphaned words in paragraphs. Applying `text-wrap: balance` makes multi-line headings visually symmetrical, while `text-wrap: pretty` prevents a single word from appearing alone on the last line of a paragraph, enhancing readability and design aesthetics with zero extra markup.

csslayouttypographytextui-uxreadability

Wanna say something?

A bug in a trick, one worth adding, or work. It goes straight to goranimperator@gmail.com.