CSS Garden All articles
Performance

Before the Tills Get Busy: A Winter CSS Audit with @supports

CSS Garden
Before the Tills Get Busy: A Winter CSS Audit with @supports

Photo: winter pruning garden shears close up frost UK, via wallpaperaccess.com

Winter is when gardeners do the unglamorous work. You cut back the dead growth, tie in the climbers, and decide what actually deserves space in spring. CSS maintenance has a similar season. Before the January sales rush, charity campaign peaks, and council service renewals, it is worth walking the stylesheet with a pair of secateurs and asking a simple question: what here is likely to fail when traffic doubles?

That is where @supports earns its keep. It is not a magic compatibility layer, and it will not make a broken layout good. But it does let you fence off risky CSS, keep the essential experience stable, and be honest about which enhancements are allowed to bloom only in capable browsers.

Start with the plants you cannot lose

On a retail site, the must-survive list is usually boring: product title, price, stock message, add-to-basket button, delivery estimate, and checkout form. On a charity campaign page, it is the donate button, Gift Aid copy, and payment iframe. On a local council site, it might be bin collection dates, emergency notices, and the blue badge application link.

Write that list down before you touch a selector. Then audit the CSS attached to it. Does the layout depend on subgrid? Does the sticky basket summary rely on position: sticky plus a container query? Is the emergency banner using :has() to detect a dismissed state? None of those are automatically bad. They are simply branches that need a support plan.

A useful first pass is to grep for modern features and group them by risk:

You are not looking for a reason to delete everything. You are looking for the places where a missing feature causes a dead end rather than a slightly different view.

Put a fence around the risky bits

@supports works best as a fence around an enhancement, not as a wrapper around your entire stylesheet. If the base layout is already usable, you can add the fancy version inside a feature query and leave the fallback alone.

For example, a product card might use container queries to switch from a stacked mobile card to a horizontal row when there is room. The base card can remain a simple block. The enhanced version can sit inside a query:

.product-card {
  display: grid;
  gap: 1rem;
}

@supports (container-type: inline-size) {
  .product-list {
    container-type: inline-size;
  }

  @container (min-width: 34rem) {
    .product-card {
      grid-template-columns: 8rem 1fr auto;
      align-items: center;
    }
  }
}

The same pattern works for selector support. If a form uses :has() to highlight a fieldset with an invalid input, keep the basic error message visible without it:

@supports selector(:has(*)) {
  .form-field:has(input:invalid) {
    border-color: #b3261e;
    background: #fff5f4;
  }
}

That is the winter prune in practice: you are not pretending the old branch is the same as the new one. You are making sure the tree still stands if the new branch does not grow.

Read the support map, not the hype

Browser support data is useful, but it is only useful when it is specific. A feature may be supported in the latest Chrome, Safari, and Firefox, yet still fail in an embedded webview used by a council payment provider or an older tablet in a farm shop. Check the support data for the exact syntax you are using, not the general feature name. :has() is broadly available in modern browsers, but the selector inside it matters. Container queries are well supported, but nested container behaviour and style queries are a different conversation.

For a UK audience, also think about the context of use. January sales traffic is not just home broadband. It is office desktops, older Android phones, iPads on shop floors, and kiosks running locked-down browsers. Charity campaign traffic often arrives through social apps with in-app browsers that lag behind. Council sites serve people who may be using assistive technology, older devices, or a shared library computer.

That does not mean designing for the lowest common denominator. It means deciding which enhancements are safe to gate and which are essential enough to rebuild in a simpler form.

Prune, label, and leave notes

Before you close the ticket, leave a note for next year. A short comment above a feature query is worth more than a Slack thread nobody can find in November 2027.

/* Enhancement: horizontal product cards only where container queries work.
   Base card remains usable without this block. */
@supports (container-type: inline-size) {
  /* ... */
}

Also record the decision in your design system or component docs. Which browsers are in scope? Which features are progressive enhancements? Which fallbacks have been tested? If a feature query is protecting a checkout step, say so. The next person should not have to reverse-engineer your intentions from a minified bundle.

The winter prune is not about making CSS smaller for its own sake. It is about removing the growth that cannot survive the season, protecting the parts that must, and labelling the rest so spring is less of a surprise. Do that before the January rush, and your stylesheet will be a lot easier to live with when the tills start ringing.


All articles

Related Articles

The Native CSS Toolbox: Twelve Features That Shrink Your Sass Build

Specificity Debt: How Your CSS Cascade Became a Weed-Choked Mess

Specificity Debt: How Your CSS Cascade Became a Weed-Choked Mess

Spring Cleaning Your CSS: The Developer's Guide to Stylesheet Maintenance

Spring Cleaning Your CSS: The Developer's Guide to Stylesheet Maintenance