Css 动画关键帧不适用于 Safari 11

标签 css animation safari css-animations

我有一个 css 关键帧背景动画可以在 Chrome 上运行,但不能在 Sarari 11 (Mac) 上运行。我尝试添加 -webkit- 前缀,它不起作用并且不再需要。

有什么想法吗?

button {
    height: 34px;
    line-height: 18px;
    font-weight: 700;
    font-size: 14px;
    position: absolute;
    bottom: 60px;
    animation-name: shiny;
    animation-duration: 5s;
    animation-iteration-count: infinite;
}

@keyframes shiny{
    0% {
        background-repeat: no-repeat;
        background-size: 300px 300px;
        background-position: -300px -300px;
        background-image: -webkit-linear-gradient(
            top left,
            rgba(255, 255, 255, 0.0) 0%,
            rgba(255, 255, 255, 0.0) 45%,
            rgba(255, 255, 255, 0.4) 49%,
            rgba(255, 255, 255, 0.5) 50%,
            rgba(255, 255, 255, 0.4) 51%,
            rgba(255, 255, 255, 0.0) 55%,
            rgba(255, 255, 255, 0.0) 100%
        );
    }
    100% {
        background-repeat: no-repeat;
        background-position: 300px 300px;
    }
}

最佳答案

I tried a simple example, it works normally

<html>
<head>
    <title>Blue Glow</title>
<style>
@-webkit-keyframes glow {
    0% { background-color: blue; }
    100% { background-color: red; }
}

div {
    -webkit-animation-name: glow;
    -webkit-animation-duration: 1s;
    -webkit-animation-iteration-count: infinite;
}
</style>
</head>
<body>
   <div>       <p>I tried a simple example, it works normally.</p>
   </div>
</body>
</html

关于Css 动画关键帧不适用于 Safari 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48097881/

相关文章:

html - 移动设备上不需要的缩放

swift - UIView 的动画颜色

css - 字体大小动画在 Safari 上无法正常工作

jquery - 我可以在一页的内容 block 上使用 jQuery Mobile 的页面转换吗?

javascript - 附加的 anchor 链接在 Safari/iPhone 上无效

html - SVG 在 Safari 10 中旋转时会改变颜色

css - 基于窗口宽度的div垂直位置

css - 哪个 CSS 选择器性能更快?类中的类与类中的标签名?

html - CSS calc 在 Safari 和回退中不起作用

css - Div 仅在 Google Chrome 中正确显示(获胜)