CSS motion path isn’t supported in safari. I’ve tried using CSS supports rule to target offset-path but it isn’t working.
if (CSS.supports("offset-path", "M0.5 1H1549.5")) {
console.log("supported yay");
// Motion path is not supported, apply fallback styles or alternative actions
// element.style.transform = "translateX(100px)";
} else {
console.log("not supported");
}
I try this logic and it doesn’t work in chromium browsers. What am I doing wrong?
2
Answers
The second parameter for
CSS.supports()
has to be a valid value. Did you perhaps forget to wrap your value inpath
?Chromium browsers do support
offset-path
property withpath()
values.But
CSS.supports()
requires the correct value syntax and otherwise, it’ll return false. There’s no in-between, i.e. a result that says "It supports the value but the syntax is incorrect".So, just use the correct value like this: