Tailwind Tailor — Tailwind CSS

Sew a page to fit a phone, tablet and desktop in Bu Sundari's shop: breakpoints and states. 15 levels, played right in the browser with nothing to install.

What you learn in this game

Tailwind is mobile-first. A class with no prefix holds at every screen width. A prefixed class such as md: holds from a width up: sm 640 px, md 768 px, lg 1024 px, xl 1280 px. In Mrs. Sundari's shop every order is tried on three mannequins at once: a phone 390 px, a tablet 768 px, a desktop 1280 px. Real Tailwind sews it, and a real browser measures it.

Every breakpoint prefix means from this width up: sm: from 640 px, md: from 768 px. There is no prefix that means "only on the phone". For the other way round Tailwind has max-*: max-sm: holds below 640 px, max-md: below 768 px. And two prefixes combine into a range: md:max-lg: holds from 768 to just under 1024 px.

hidden is display: none: the element is gone and takes no room. invisible is visibility: hidden: unseen, but its room stays. To show a hidden element again, give it a prefixed display class: md:block, md:flex, md:grid.

grid-cols-n splits a gallery into n equal columns. A tile can widen over several columns with col-span-n and grow over several rows with row-span-n. Each of them takes a breakpoint prefix.

There are two ways to space children. gap-* belongs to a flex or grid container: the space between children, both ways (gap-x-* and gap-y-* for one way). space-x-* and space-y-* give the children a margin, all but the last.

When the Tailwind theme lacks the value you need, write it yourself in square brackets: w-[137px], bg-[#1da1f2], grid-cols-[200px_1fr] (an underscore is a space). It is an escape hatch: when the same value keeps coming back, add it to the theme. Beware of fixed numbers for sizes that should stretch.