.grainbow { animation: grainbow .4s linear infinite alternate; transition-duration: 1s; } @keyframes grainbow { 0% {color:red} 20% {color:orange} 40% {color:yellow} 60% {color:green} 80% {color:blue} 100% {color:purple} }