这可以通过"动画填充模式"定义为"转发",至少在Webkit中是这样.我用这样的代码得到了这个结果:
@-webkit-keyframes test {
100% { background-color: #0000ff; }
}
a { background-color: #ff0000; }
a:hover { -webkit-animation: test 1s 1 ease forwards }
Run Code Online (Sandbox Code Playgroud)
请注意,无需在0%关键帧和结束颜色中指定起始颜色:hover.
当然,此代码是特定于Webkit的.我没有尝试过其他浏览器与其他供应商前缀或一般的"动画"属性.