3

イオコン(SVG だと思います) に繰り返し色を変えてもらいたいです。次のことを試しましたが、svgアイコンが紫色でしか表示されません:

エレメント

<a class="ion-social-twitter button-home"></a>

CSS

.button-home {
    fill: #fff;
    -webkit-animation: animation-button 20000ms infinite;
    -moz-animation: animation-button 20000ms infinite;
    -o-animation: animation-button 20000ms infinite;
    animation: animation-button 20000ms infinite;
    font-size: 25vh;
}

@-webkit-keyframes animation-button {
    0%   {fill:red; }
    25%  {fill:yellow; }
    50%  {fill:blue; }
    75%  {fill:green; }
    100% {fill:red; }
}
@keyframes animation-button {
    0%   {fill:red; }
    25%  {fill:yellow; }
    50%  {fill:blue; }
    75%  {fill:green; }
    100% {fill:red; }
}
4

2 に答える 2

1

そのタイプのアイコンフォント, So tyr to use color (not fill)

.button-home {
    color: #fff;
    -webkit-animation: animation-button 20000ms infinite;
    -moz-animation: animation-button 20000ms infinite;
    -o-animation: animation-button 20000ms infinite;
    animation: animation-button 20000ms infinite;
    font-size: 25vh;
}

@-webkit-keyframes animation-button {
    0%   {color:red; }
    25%  {color:yellow; }
    50%  {color:blue; }
    75%  {color:green; }
    100% {color:red; }
}
@keyframes animation-button {
    0%   {color:red; }
    25%  {color:yellow; }
    50%  {color:blue; }
    75%  {color:green; }
    100% {color:red; }
}
于 2015-03-16T13:59:04.283 に答える
1

フォントとしてioniconsを使用します。fillこのように をに変更するだけcolorです -

@-webkit-keyframes animation-button {
    0%   {color:red; }
    25%  {color:yellow; }
    50%  {color:blue; }
    75%  {color:green; }
    100% {color:red; }
}

@keyframes animation-button {
    0%   {color:red; }
    25%  {color:yellow; }
    50%  {color:blue; }
    75%  {color:green; }
    100% {color:red; }
}

Bootstrap Glyphicons を使用したデモです。

フィドル

于 2015-03-16T13:31:06.343 に答える