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