Every space-y class did nothing, and every test passed
· 4-minute read · Engineering · by Direct Softworks
Tailwind v4 wraps its space utilities in a zero-specificity selector. Load an unlayered reset after it and every one of them goes quietly inert.

The markup said space-y-6. The class was on the element. The rule was in the stylesheet. The children had no margin at all.
The first guess, always, is that the class was never generated: a content path missing from the config, a typo, a purge step. It was not that. The rule existed, it matched the right elements, and it lost. When we counted, there were 38 of these classes across 13 files, on the marketing site and in the management panel, and not one of them was doing anything.
What Tailwind v4 actually emits
In version 4, a space utility is not a plain class selector. Stripped of the variables it uses to support reversed order, space-y-6 compiles to something like this:
:where(.space-y-6 > :not(:last-child)) {
margin-block-end: calc(var(--spacing) * 6);
}
The upgrade guide explains that the selector changed from version 3 to fix performance problems on large pages. What it does not dwell on is the :where() around it, which you only see in the generated CSS.
Everything inside :where() contributes zero specificity. The selector still matches the same elements, but in the cascade it weighs (0,0,0). The effect is that the utility is trivially easy to override, which suits a library. It is also exactly as weak as a bare *.
The reset that wins the tie
This site has its own hand-written CSS, older than Tailwind in the repository, and it starts the way most hand-written CSS starts:
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
Also (0,0,0). Neither rule is inside a cascade layer. So the two declarations of the same property tie on every count the cascade checks before the last one, and the last one is source order: the declaration that appears later wins.
Our root layout imports the Tailwind entry first and the base stylesheet second. The reset comes later, so the reset wins, and every space utility on the site is set back to zero.
That also explains why the breakage looked random. Ordinary margin utilities such as mt-8 or mb-4 are class selectors at (0,1,0). They beat * regardless of order, so they worked. Half the spacing on a page was correct and the other half was not, which is the kind of bug people blame on their own markup for a long time before they suspect the cascade.
The comment that was right about everything else
The Tailwind entry file has a header comment explaining a careful decision. The utilities are deliberately loaded outside any cascade layer, because the hand-written CSS is unlayered too, and unlayered rules always beat layered ones. Had the utilities gone into a utilities layer, the reset would have beaten all of them. Unlayered, they win on specificity.
The reasoning is correct. It is correct for every utility except the ones wrapped in :where(), and those are the ones it never considered. The argument had one unstated assumption, that every utility weighs at least as much as a class, and that assumption was false for exactly one family.
Why nothing caught it
Type checking passed. The build passed. The tests passed. None of them evaluates a cascade, and a test that asserts the class is present on the element passes happily on an element whose margin is zero.
The one check that tells the truth is the browser's computed style. Open the page, select a child of the container, and ask for getComputedStyle(el).marginBlockEnd. On any of these elements it returns 0px. That is a one-line check, and for anything visual it is the only verification that counts, because it is the only one that runs the cascade.
What we did, and what we did not do
There was a one-line fix available: swap the two imports so the reset loads first and Tailwind wins the tie. We did not take it. Every one of those 38 dead classes would have come alive in the same deploy, on screens that had only ever been looked at with those margins at zero. That is a visual change to every page at once, decided by an import order.
Instead, the replacement is flex flex-col gap-6, or grid gap-6. gap is not a margin, so no reset touches it, it does not care which child is last, and it is what the Tailwind upgrade guide itself recommends over space utilities. The result step of our quote wizard was the screen fixed that way when we found this, and the working rule since is to reach for gap wherever a space utility would have gone.
The general shape
A zero-specificity rule ties with every reset you have ever written, and a tie is decided by the order of an import list nobody reads. :where() is how a library makes its rules easy to override. The cost is that a very old line in your own CSS can override them by accident.
It is the same family as the captcha that silently never rendered: no error, no warning, a perfectly normal-looking page, and a toolchain that cannot see the thing that is wrong. When the failure mode is visual, look at the rendered result, not at the source that was supposed to produce it.