Vet Post Screen — Tailwind CSS

Build Pos Keswan's queue board with Tailwind: flex, transforms, transitions, reduced motion, themes. 16 levels, right in the browser.

What you learn in this game

In Tailwind, flexbox is written as classes: flex on the container, then justify-* for the main axis (across, in a row) and items-* for the cross axis (up and down). At the vet post the queue board is open on two screens at once: the TV in the yard (640 px) and Grandma Marni's phone (360 px). Real Tailwind lays it out, and a real browser measures it.

Transforms in Tailwind (scale-*, rotate-*, translate-*) change an element's drawing, not its place in the layout. The box the browser lays the neighbours out by stays where it was. From this level the board measures both: the box drawn (getBoundingClientRect) and the box in the layout (measured once more with transforms switched off for a moment).

A transition in Tailwind is written in two parts: what transitions (transition-colors, transition-opacity, transition-transform, or transition) and for how long (duration-*, in milliseconds). With no duration-*, Tailwind uses 150 ms. From this level the board is played step by step: at rest, then the number is called. The transitions the browser starts are read through getAnimations().

Many people set their phone or computer to reduce motion: for vertigo, for migraines, or because they do not like it. The browser passes that on as prefers-reduced-motion, and Tailwind reads it with two prefixes: motion-safe: and motion-reduce:.

A focus mark is the only clue for someone on a keyboard. Tailwind draws it two ways: ring-* (a shadow with no blur) and outline-* (an outline). Both are drawn outside the box, unless it is ring-inset or an outline with a negative offset. The board measures a focus mark the way an eye sees it: there or not, how much of it shows, and its contrast with what is behind it.

In Tailwind a component is usually one class list used again (in React, Vue or Blade), not copies edited in every place. Copies drift slowly: a little more padding here, a different corner there. A component's state can be read from its attributes: data-* for states of your own, aria-* for states a screen reader reads out too.