Testing at-rules without an at-rule test
@supports has grown well beyond property/value pairs: selector() covers selectors, while font-format() and font-tech() handle font formats and technologies. What it still cannot do is test whether another at-rule is supported. The CSSWG resolved in 2022 to add an at-rule() wrapper function, but browser progress has been slow; as of this writing, the Chrome team had only moved its status from "new" to "assigned."
The telltale-property technique
Bramus documented a workaround: test a property that shipped alongside the target at-rule. If the companion feature is supported, the at-rule probably is too — and the reverse. His example checks animation-timeline to infer support for the now-discontinued @scroll-timeline at-rule, which shipped at the same time. He calls these "telltale" properties.
@supports (animation-timeline: works) {
/* @scroll-timeline is supported*/
}
/* Note: @scroll-timeline doesn't exist anymore */
The list below covers at-rules that can be tested today. It leaves out at-rules with no browser support (@color-profile, @when, @else), deprecated ones (@document), and long-established ones (@page, @import, @media, @font-face, @namespace, @keyframes).
Property-based recipes
@container size queries
Size queries come with plenty of telltale properties in the same module: container-type, container-name and the container shorthand all evaluate identically, so any of them works.
@supports (container-type: size) {
/* Size queries are supported! */
}
A @supports query can also be nested inside a @container, or the other way around.
@supports (container-type: size) {
@container (width > 800px) {
/* Styles */
}
}
@font-feature-values and @font-palette-values
For alternate glyphs defined via @font-feature-values, the telltale property is font-variant-alternates.
@supports (font-variant-alternates: swash(custom-ident)) {
/* @font-feature-values is supported! */
}
The same approach covers @font-palette-values, which modifies multicolor fonts: test the font-palette property.
@supports (font-palette: normal) {
/* @font-palette-values is supported! */
}
@position-try
Custom anchor fallback positions are defined with @position-try, one of the newest at-rules here, and its module offers several candidate properties. Note that some were renamed after their initial introduction, so anchor-name or position-try make the safer telltales.
@supports (position-try: flip-block) {
/* @position-try is supported! */
}
@view-transition
@view-transition is not yet baseline. Testing view-transition-name, released close to it, is the simplest route.
@supports (view-transition-name: custom-ident) {
/* @view-transition is supported! */
}
Alternatively, selector() can check for one of its pseudo-elements.
@supports selector(::view-transition-group(transition-name)) {
/* @view-transition is supported! */
}
@counter-style: a telltale value
Custom list counters have no matching property to probe. Instead, rely on a telltale value: since the at-rule arrived, list-style-type accepts <custom-ident> in addition to its predefined keywords, so testing that value reveals support.
@supports (list-style: custom-ident) {
/* @counter-style is supported! */
}
Recipes without @supports
Some at-rules can only be handled by writing the styles inside them and layering them over a base.
@container style queries
Style queries have no property or value specific to them, because every element has style containment by default. Skip @supports entirely: declare base styles, then override them inside a style query, which older browsers simply ignore.
.container {
--supports-style-queries: true;
}
.container .child {
/* Base styles */
}
@container style(--supports-style-queries: true) {
/* Container queries are supported! */
.child {
/* We can override the base styles here */
}
}
@scope
@scope follows the same progressive enhancement pattern — base styles outside, overrides inside the @scope block, which is only honored where supported.
.foo .element {
/* Base style */
}
@scope (.foo) to (.bar) {
:scope .element {
/* @scope is supported, override base style */
}
}
Still unsolved
Three at-rules resisted a recipe: @layer, @property, and @starting-style. All are reasonably supported in modern browsers, but that does not remove the need to test. @layer might yield to the @scope approach — a base style upgraded via progressive enhancement — while @property and @starting-style remain open questions. A demo applying these recipes is available, styling each at-rule's test with @supports.



