Tic-tac-toe, no JS
Turn order, win detection and the reset are all native: no click handlers anywhere.
A collection of demos for CSS that shipped in the last couple of years. Everything runs live on plain CSS, with no JavaScript faking what the browser can now do on its own, and every demo comes with a short explainer of how it works. Some of it isn’t in every browser yet, and each demo says where support stands. Hope you enjoy these as much as I do!
(BTW: Be on the lookout for tiny CSS toys)
Bevel, notch, scoop or squircle any corner, and draw a border along any shape at all.
(these corners are corner-shape, hover to transition):has()An ancestor that reacts to the state of its own descendants.
(hover chips to see the card react in three different ways)@containerA component that reflows based on its container, not the viewport.
(hover to see the box's layout change)anchor-name / position-anchorTether a popover to any element with pure CSS, no JS positioning math.
(the chip is attached to the anchor icon without JS)Native nested selectors, media queries, and the & parent selector.
startViewTransition()Animated, morphing transitions between DOM states with one function call.
animation-timelineAnimations timed to scroll position instead of a clock, no JS listeners.
@starting-style / allow-discreteAnimate an element in and out of display: none, no keyframes, no JS.
@scopeContain a selector to a subtree without renaming every class.
scroll-marker-group / ::scroll-button()Swipe, snap, prev/next buttons, and dot markers, generated with no JS.
@propertyGive a custom property a syntax type so the browser can animate it, not just swap it.
@layerDecide who wins the cascade by layer order instead of counting selector specificity.
Bonus round: play around with these
Small JS-free interactive bits.
Turn order, win detection and the reset are all native: no click handlers anywhere.
A typed integer custom property is transitioned, then rendered as text through a CSS counter. The bar is the same number, as a width.
The layout, seat size and caption all change based on how many items are switched on, with the count read directly by :has().
Hello from the top layer.
Click outside, or press Esc, and it dismisses itself. The dim, blurred backdrop and the entrance animation are CSS too.
Open, close, light-dismiss, Escape handling and focus management come from the popover attribute alone.
turns, wins and reset, all CSS
trigonometry, in CSS
switch guests on