css - `animation-fill-mode: none;` 不工作

标签 css css-animations

根据 https://developer.mozilla.org/en-US/docs/Web/CSS/animation-fill-mode , animation-fill-mode: none; 不应在动画开始前将第一帧的样式应用于元素。但是,animation-fill-mode: backwards 应该。

但是在这个demo在下面的代码中,似乎 none 正在做 backwards 应该做的工作。为什么?

/* I have autoprefixer enabled */
div {
  width: 100px; 
  height: 100px; 
  background-color: red;
  transform: translate(0, 0);
  animation: someAnimation 1s linear 1s;
  animation-fill-mode: none;
  -webkit-animation-fill-mode: none;
}

@keyframes someAnimation {
  0% {
    transform: translate(50px, 50px);
  }

  100% {
    transform: translate(100px, 100px);
  }
}

最佳答案

  1. 你在第一个语句中拼错了 animation-fill-mode
  2. 您没有为动画和过渡属性设置 -webkit- 前缀,也没有启用无前缀,因此未提供 webkit

一旦你fix those他们应该以不同的方式工作

关于css - `animation-fill-mode: none;` 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23916162/

相关文章:

html - 换行后将文本与之前的文本对齐

html - 如何创建不同的过渡/动画延迟?

css - Animate.CSS 添加滚动条?

JavaScript 单击停止开始时钟时间

html - 使用其他元素调整 div 中的图像大小

css - 图像在边框和填充后悬停时跳转

javascript - Flask:资源被解释为样式表但以 MIME 类型文本/html 传输

css - 如何使用 ng-hide/ng-show 动画

css - 动画 SVG 来回填充

css - React 组件滑入/滑出