CSS variables that resolve to nothing, and components that render invisible
· 4-minute read · Engineering · by Direct Softworks
A toast with no background and a button with a box nobody asked for. Two bugs from one afternoon, both caused by CSS doing exactly what the specification says.

On the same day in our management panel, two things looked wrong. Toast notifications rendered as bare text floating over the dark interface, with a close button hanging in the air beside them. And every button drew a thick grey box around itself, including tab triggers and icon-only delete buttons that were supposed to have no border at all.
Neither produced a console error. Neither was caused by the component that showed it. Both were the stylesheet doing precisely what the CSS specification says it should, which is the most annoying kind of bug to have.
The toast with no background
The toast component came from a popular copy-and-paste component collection. Its stock styling sets the toast's background from var(--popover), its border from var(--border), and so on: short, raw custom property names that the collection's default theme declares.
Our panel does not declare those names. It has its own tokens for surfaces, ink and rules, and it maps them into Tailwind's theme under the --color-* names: --color-popover, --color-border. The raw --popover was never declared anywhere. So the toast asked for a variable that did not exist.
What happens next is specific. A var() that points at an undefined custom property, with no fallback, does not make the browser skip the declaration. It makes the property behave as if it were unset. By the time the browser substitutes the variable, it has already thrown away the other values in the cascade, so it cannot fall back to them. For background-color, unset means the initial value, which is transparent.
Hence a toast with no card behind it. The declaration was there and it was spelled correctly. It just computed to nothing.
The fix was to point the component at tokens that exist: our overlay surface for the background, our ink colour for the text, our stronger rule colour for the border. The broader rule is the useful part. When you bring a vendored component into a project with its own design tokens, grep it for var(-- before you ship it, and check every name against what your stylesheets actually declare.
The button with a box nobody asked for
The second bug took longer, because the box was not coming from anything on the button.
Our marketing site's base stylesheet strips the browser's default button chrome with button { border: none }. That looks like it removes the border. What it actually does is set the border style to none, and because border is a shorthand, it also resets every longhand it does not mention to its initial value. The initial value of border-width is medium, which the CSS specification defines as 3px.
On the marketing site that is invisible. The specification says a border's computed width is zero whenever its style is none, so a 3px width with no style draws nothing.
The panel, however, carries a small scoped version of Tailwind's reset, and that reset forces border-style: solid on every element, because Tailwind's border utility sets only a width and relies on the style already being solid. The moment the style became solid, the 3px width that had been sitting there all along became real, in the panel's rule colour, on every <button>.
The panel's reset did also say border-width: 0. It lost. That rule is wrapped in :where(), which contributes zero specificity, so that utility classes can override it the way they override Tailwind's own reset. Zero specificity also loses to the base stylesheet's plain button selector, at (0,0,1). So buttons kept their 3px.
The fix is one rule:
:where(body:has(.mgmt-root)) button {
border-width: 0;
}
The scope sits inside :where(), so the selector's specificity is exactly that of button: (0,0,1). It ties the base stylesheet and wins on order, because the panel's stylesheet loads later. And it still loses to a border utility at (0,1,0), so the outline buttons that genuinely want a hairline keep it.
Links and <div role="button"> were never affected, because the base stylesheet only sets the border shorthand on <button>. Anything that looked like a button without being one escaped.
Why editing the component never helped
Tab triggers were among the most visible victims, and the obvious move is to edit the tab component's classes. That never fixes it, because nothing in those classes is responsible. The offending width came from the cascade, not from any class on the element.
Both bugs share this shape. The thing that looks wrong is the leaf, and the cause is two or three rules away, in files that were each correct on their own. A class list tells you what the author asked for. The computed style tells you what the browser decided. Only the second one is the truth.
The wider point
CSS does not error. A variable that resolves to nothing, a shorthand that resets what you did not mention, a reset that loses on specificity: each of them is valid, each produces a well-defined result, and none of them tells you anything happened.
That puts CSS in the same category as the captcha that silently never rendered: the system was working exactly as designed, and the design was answering a different question than the one we were asking. The habit that catches both is the same one. Before you change anything, open the computed styles for the broken element and ask where each value actually came from. The inspector will name the rule. It is very rarely the one you were about to edit.