1

Basically I am designing something where the backdrop-filter CSS property is used. As of today this is not supported in Firefox, which means that my thing looks kind of terrible in Firefox. My semi-solution is to add a background color instead (not as pretty, but will work) instead, when Firefox is used. But this background should not be there in other browsers.

What to do ? :)

Denver Dang
  • 2,433
  • 3
  • 38
  • 68
  • 1
    [see `@supports`](https://developer.mozilla.org/en-US/docs/Web/CSS/@supports). – zzzzBov Apr 05 '21 at 16:07
  • you could use filters: https://developer.mozilla.org/fr/docs/Web/CSS/filter It's experimental but supported by every browser – Gibberish Apr 05 '21 at 16:07
  • Does this answer your question? [How to check if -webkit-text-stroke is supported in browser](https://stackoverflow.com/questions/60390697/how-to-check-if-webkit-text-stroke-is-supported-in-browser) – Heretic Monkey Apr 05 '21 at 16:57

3 Answers3

1

There is a good article about how to apply different styles for different browsers.

So code can look like this:

/* Style only for Google Chrome/Opera */
@media screen and (-webkit-min-device-pixel-ratio:0) {
  .foo {
      background: lightgreen;
  }
}

/* Style only for Mozilla Firefox */
@-moz-document url-prefix() {
  .foo {
      background: lightgreen;
  }
}

/* Style only for Internet Explorer */ 
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  .foo {
      background: lightgreen;
  }

}
StepUp
  • 36,391
  • 15
  • 88
  • 148
0

Use a direct feature query to determine if the browser supports this feature. I think you should be able to use the following query:

@supports (backdrop-filter: none;) {
  Your css using this feature. 
}

More on this https://developer.mozilla.org/en-US/docs/Web/CSS/@supports.

The browser family query isn't as reliable as you will also need to know the version, and it won't update when a newer version of Firefox supports this feature.

Ben Carp
  • 24,214
  • 9
  • 60
  • 72
-1

You can use @supports to target a browser by feature. For Firefox, this should work -

@supports (-moz-appearance:none) {
    .element { background-color: blue; } 
}