html - 如何使用 css 动画多次更改颜色?
问题描述
我想用 Css 动画无限多次更改文本的颜色。
<div class="footer-
widget-area">
<div class="col-md-3 col-sm-
6 footer-widget"
role="complementary">
<div id="text-4"
class="widget widget_text">
<div class="textwidget"><p>.
<a href="http://4309.co.uk
/contact/">Contact</a></p>
</div>
</div>
CSS
#text-4 a{ animation: change
1s forwards; animation-
delay: 11s;}
@keyframes change
{from{color:white;} to
{color:
blue;} to{color:yellow;}}
这不起作用,因为 second coloryellow
会覆盖 first color blue
。
解决方案
与百分比一起使用,例如:
#text-4 a{ animation: change
3s forwards infinite; animation-delay: 5s;}
@keyframes change
{
0% { color: blue; }
25% { color: orange; }
50% { color: yellow; }
75% { color: black; }
100% { color: red; }
}
<div class="footer-
widget-area">
<div class="col-md-3 col-sm-
6 footer-widget"
role="complementary">
<div id="text-4"
class="widget widget_text">
<div class="textwidget"><p>.
<a href="http://4309.co.uk
/contact/">Contact</a></p>
</div>
</div>
推荐阅读
- php - 为 EntityManager 创建扩展的真正方法
- android - react native 组件在运行时如何作为视图、ViewGroup 或 Fragments 表现?
- c# - 模拟 OrmLiteReadApi 扩展方法
- javascript - 如何在html中提取类的最后一位?
- python - Python中有没有像Apache Nifi这样的替代品?
- file - 在 Go 中写入文件中的字节范围
- google-apps-script - 使用单元格中的值作为目标单元格地址(间接复制)
- r - 使用正则表达式在 R 中提取字符串以获取可变数量的实例
- exception - install4j 抛出 java.lang.NoClassDefFoundError: com.install4j.runtime.beans.screens.SystemFormScreen 错误
- postgresql - 在 Spark 2.x 的 JDBC 中设置 fetchSize?