Supports @supports?

In css there are now @supports queries to apply rules only to browsers that support specified css.
But what happens in browsers that don’t support @supports?
Will it use the css within the query regardless of the @ query?
Or will it just ignore the whole block of code until the closing bracket of the query?

2 Likes

It looks like the latter in tests so far, which is what I hoped for.

Same for me just now. I tried

@supports (background-color: #F00) {
 p {
  background-color: #F00;
 }
}

Support for @support looks good except for IE

Testing with Chrome, Edge, Opera Dev and Vivaldi = red <p>s
IE 11 = default <p>s, no style shown in dev tools for the rule.

3 Likes

They should ignore the at-rule all together:
https://drafts.csswg.org/css-conditional-3/#conform-partial

3 Likes

Yes that’s the way it’s supposed to work (apart from the odd bug).:slight_smile:

4 Likes

It seems to be working as expected.
I now have a sticky “to top” button for mobiles that appears and sticks at 140vh down the page that displays as a permanent fixed button for non sticky browsers. :slight_smile:
No js involved! :open_mouth:

3 Likes

For anyone curious or interested, I have thrown together a quick mock-up to illustrate it.

You will need to narrow the viewport and scroll down to see it.

4 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.