Chaining feature detections

suggest change

To detect multiple features at once, use the and operator.

@supports (transform: translateZ(1px)) and (transform-style: preserve-3d) and (perspective: 1px) {
  /* Probably do some fancy 3d stuff here */
}

There is also an or operator and a not operator:

@supports (display: grid) or (display: flex) {
  /* At least one modern layout model is available. */
}
@supports not (container-type: inline-size) {
  /* Used when size container queries are unavailable. */
}

For the ultimate @supports experience, try grouping logical expressions with parentheses:

@supports ((display: grid) and (grid-template-rows: subgrid)) or
          ((container-type: inline-size) and (selector(:has(*)))) {
  /* ... */
}

This condition succeeds when the browser supports Grid together with row subgrid, or container queries together with the :has() selector. Parenthesize mixed operators so the intended grouping is explicit.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents