I am wondering if there is a way to detect if a browser is capable of
animating SVG elements using CSS
Simple Answer: Yes you can as stated by @jhpratt.
You can detect if a browser supports CSS-Functionality with only CSS.
The @supports
CSS at-rule lets you specify declarations that depend on a browser's support for one or more specific CSS features. This is called a feature query.
Example:
@supports (display: flex) {
div {
display: flex;
}
}
@supports not (display: flex) {
div {
float: right;
}
}
MDN Link: https://developer.mozilla.org/de/docs/Web/CSS/@supports
Long Answer:
You will always have some cross-browser
issues.
The problem you have encountered is bothering every Webdeveloper. Still there are ways to get around with this Browser-Support-Problem:
1. You can check "can I use" for compatibility:
Link: http://caniuse.com/
It is recommend to look up any functionality which is questionable like animations.
2. Use an autoprefixer in your workflow:
With the help of an autoprefixer you don't have to worry most of the time about using CSS with a prefix like -moz-, -webkit-, etc. This tiny helper will do the trick for you, you can even tell some autoprefixers which browsers you want to support.
3. User 3rd - Party libraries:
There are many libraries out there which you can use to detect the browser and version. If you want to be sure that your animation is secure to use, you can simply use the provided animation from the libraries and of course look the compatibility up before on their respective websites.
Some Big Names:
there are many more, jsut search the world wide web.
4. Use CSS Hacks to detect specific Browsers:
It is possible to use so called CSS-Hacks. They are specific CSS calls, which only apply on certain browsers.
Some examples:
Internet Explorer/Edge 8 only: @media \0screen {}
firefox ≥ 3.6 only: @media screen and (-moz-images-in-menus:0) {}
Opera ≤ 9.27 AND Safari 2: html:first-child .selector {}
You can look up more Browserhacks here: http://browserhacks.com/
Conclusion:
It is possible to detect specific browsers, but it is not possible to detect if the brwoser is supporting the given feature with only CSS. That is why you will always have some hard times with browser support.
Hope this helps.
Regards
DIV
using the same piece of CSS. jsfiddle.net/v1oh3d99/2 So it's not only an issue about transform. – Landowner<animateTransform>
work on FF5 (it should) ? – Quiteris