Urgent.News

What's breaking now, across thousands of outlets.

Tech

@supports named-feature() lets you branch on behavior, not syntax

The test you can't write today Say you want to branch a stylesheet on how an engine resolves anchor positioning around CSS transforms. Both browsers parse position-anchor . Both accept anchor() . The declarations look identical to @supports . What differs is behavior, and behavior is invisible to a parser check. Bramus opens on exactly this bind: @supports has only ever asked whether a string can…

CSS now offers a new method called @supports named-feature(), enabling developers to branch stylesheet logic based on browser behavior rather than syntax. This feature provides a cleaner way to check for specific engine capabilities, rather than just the presence of properties, values, selectors, or at-rules. The named-feature() shape introduces a keyword to determine if an engine recognizes a particular behavior.

Currently, two keywords are discussed: anchor-position-follows-transforms and single-axis-scroll-container. These keywords will be added to the CSS specification only when a behavior is deemed significant enough to warrant a name. The alternative to using this feature would be user-agent sniffing or JavaScript-based checks, which would require additional code and maintenance outside of the stylesheet.

By utilizing @supports named-feature(), the answer to the question of whether a behavior is supported is placed within the cascade, at the parsing stage, alongside the property it protects. This approach addresses the long-standing issue of not having a way to inline the second aspect of interop stories: does the property work as specified?

As more interop fixes and new combinations of existing features emerge, they will become potential candidates for creating new keywords in the future.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Allowlist Every Path a Docs Generator May Write

Generated reference docs stay trustworthy when a generator may write only restatable files under an allowlisted path. Support windows, uptime figures, and deprecation calendars belong in a second tree…

  • Generator limited to allowlisted directory paths
  • Separate tree for Windows uptime and deprecation
  • Linter flags unauthorized boundary crossings

How Scale Should Change the Way You Think in Tech

Most engineers learn technology by asking: “How do I make this work?” That is the right question—at the beginning. But as systems grow, it becomes the wrong question.

  • Shift focus from "how to make it work" to "what happens when it works for everyone"
  • At scale, engineers must think about system interactions, not just features
  • At large scale, failures become the norm and require proactive preparation

More from Tuesday 8 September →