Search code examples
cssfeature-detection

CSS feature detection using media queries


I'm trying to detect if the browser supports the transform property.

To do so I'm wrapping the code I want to apply when the transform is supported inside a media query:

@media (transform: none) {
  // My code 
}

With this code, this part is not triggered.

The initial state of transform is none so I'm wondering why it doesn't trigger...


Solution

  • From looking at the most recent media queries spec, this is not possible.

    Also, to quotefrom here in the spec:

    CSS renderers must treat as invalid (and ignore as appropriate) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support.

    Ignoring anything inside is to adhere to the spec.