Exhibit 21 of 23
A header that knows it’s stuck
Scroll the paper. Each section’s heading sticks to the top of the box, and while it is stuck it turns dark and says “reading now”. No scroll listener decides that.
The exhibit
Front page
- The clocks agreed for a whole minute this morning. Nobody could say which minute.
- A door in the showroom opened onto another showroom. Staff say this is normal.
- A door marked Staff Only was found to lead to more staff. Inquiries continue.
On the floor
- The club’s crowd danced the whole of the warm-up without being asked.
- A pigeon was seen carrying a postcard to the decks. It did not deliver it.
- The stage lights stayed under three flashes a second all night, as usual.
Small ads
- Wanted: one left glove. Will swap for a right.
- For sale: a box of screws, slightly danced on.
- Free to a good home: an echo. Collect from the staff stairs.
Letters
- Sir, the photocopier upstairs is on again. Yours, a reader.
- Sir, my postcard says “wish you were here”. I am here. Yours, confused.
- Sir, oat milk is not milk. Yours, a machine.
Results
- Noughts and crosses: drawn, again.
- Rule 110: still going, as long as somebody presses Step.
- Clocks: all correct, several of them sideways.
How it works
Every heading is position: sticky; top: 0, which has been possible for years. What is new is container-type: scroll-state on it: the heading becomes a container that knows its own scroll state, and @container scroll-state(stuck: top) styles what is inside it only while it is stuck. The usual way needs a script with an IntersectionObserver and a class to toggle.
A container can’t restyle itself with its own query, only what is inside it, so the heading wraps its text in a span, and the span is what changes.
The key CSS
Cut from this exhibit’s stylesheet as it is served.
/* every heading sticks to the top of the box, and is a container whose stuck state CSS can ask about */
.x-stuck .sec-head {
position: sticky; top: 0; z-index: 1;
container-type: scroll-state;
}
/* while it is stuck: lift it off the page and say so */
@container scroll-state(stuck: top) {
.x-stuck .sec-name { background: var(--ink); color: var(--paper); box-shadow: 0 10px 18px rgb(0 0 0 / .25); }
.x-stuck .sec-name::after { content: "reading now"; margin-left: auto; padding: 2px 10px; border-radius: 999px; background: var(--acid); color: var(--on-acid); font: 700 12px/1.6 Arial, sans-serif; letter-spacing: 0; }
}
Accessibility
The box is a focusable, labelled region, so the keyboard can scroll it, and the headings are real headings, so a screen reader can jump between sections. The stuck look is visual only; a screen reader doesn’t need to know which heading is pinned. Where scroll-state queries are missing, the headings still stick and simply don’t change.
Browser support
scroll-state queriesWorks in this browser.Not in this browser: The heading still sticks; it just doesn’t change when it does. Checked 2026-11-13: Chromium 140 yes, Firefox 141 no.
