【发布时间】:2014-04-24 18:40:00
【问题描述】:
我想用两种不同的颜色闪烁文本:
例如:闪烁的文字白-绿-白-绿-白-绿
我不介意 jQuery 还是 CSS。
【问题讨论】:
-
<blink>有充分的理由退休。 -
告诉我们您的尝试,我们将能够为您提供帮助!
我想用两种不同的颜色闪烁文本:
例如:闪烁的文字白-绿-白-绿-白-绿
我不介意 jQuery 还是 CSS。
【问题讨论】:
<blink> 有充分的理由退休。
与我更好的判断相反,哈哈...您需要调整与 webkit 等的跨浏览器兼容性
经过编辑,可与所有浏览器一起使用
<a href="#"> text</a>
/* css */
a {
animation-duration: 400ms;
animation-name: blink;
animation-iteration-count: infinite;
animation-direction: alternate;
}
@keyframes blink {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
【讨论】:
-webkit-,它在我最新版本的 chrome 中不起作用。您可能应该在某处提到这一点。
不支持 IE 9:animation-iteration-count
注意要支持当前不支持的浏览器,您可以使用 Modernizr:
见How do I normalize CSS3 Transition functions across browsers?
CSS3 animation-fill-mode polyfill
@-webkit-keyframes blink {
from { color: green; }
to { color: white; }
}
@-moz-keyframes blink {
from { color: green; }
to { color: white; }
}
@-ms-keyframes blink {
from { color: green; }
to { color: white; }
}
@-o-keyframes blink {
from { color: green; }
to { color: white; }
}
@keyframes blink {
from { color: green; }
to { color: white; }
}
.blink {
color: green;
-webkit-animation: blink 2s 3 alternate;
-moz-animation: blink 2s 3 alternate;
-ms-animation: blink 2s 3 alternate;
-o-animation: blink 2s 3 alternate;
animation: blink 2s 3 alternate;
}
【讨论】: