首页 > 解决方案 > 白色背景的动画不起作用

问题描述

我正在为按钮设置一个简单的动画。

@keyframes test {
  from {
    background-color: blue;
  }
  to {
    background-color: green;
  }
}

button {
  animation-name: test;
  animation-duration: 1s;
  animation-iteration-count: infinite;
}
<button style="width: 200px; height: 200px; background-color: white;">button</button>

当按钮的背景颜色为白色时,动画是不可见的。当按钮具有红色背景色时,动画可见。为什么?

标签: htmlcss

解决方案


推荐阅读