html - CSS Transition when unhovered -
i trying make text change color in rainbow on hover , it's working well, issue when take mouse off of text jumps original color , fluidly fade last color original 1 looks smoother.
also, if recommend doing different way or in other languages open doing that.
i'm new transitions , can't seem figure out.
<style> .logo { font-size: 100px; margin-top: 10px; margin-bottom: 5px; margin-right: auto; margin-left: auto; color: #ff006e; } .logo:hover { -webkit-animation:logo 1s infinite; -ms-animation:logo 1s infinite; -o-animation:logo 1s infinite; animation:logo 1s infinite; } @-webkit-keyframes logo { 0% {color: #ff0000;} 10% {color: #ff8000;} 20% {color: #ffff00;} 30% {color: #80ff00;} 40% {color: #00ff00;} 50% {color: #00ff80;} 60% {color: #00ffff;} 70% {color: #0080ff;} 80% {color: #0000ff;} 90% {color: #8000ff;} 100% {color: #ff0080;} } @-ms-keyframes logo { 0% {color: #ff0000;} 10% {color: #ff8000;} 20% {color: #ffff00;} 30% {color: #80ff00;} 40% {color: #00ff00;} 50% {color: #00ff80;} 60% {color: #00ffff;} 70% {color: #0080ff;} 80% {color: #0000ff;} 90% {color: #8000ff;} 100% {color: #ff0080;} } @-o-keyframes logo { 0% {color: #ff0000;} 10% {color: #ff8000;} 20% {color: #ffff00;} 30% {color: #80ff00;} 40% {color: #00ff00;} 50% {color: #00ff80;} 60% {color: #00ffff;} 70% {color: #0080ff;} 80% {color: #0000ff;} 90% {color: #8000ff;} 100% {color: #ff0080;} } @keyframes logo { 0% {color: #ff0000;} 10% {color: #ff8000;} 20% {color: #ffff00;} 30% {color: #80ff00;} 40% {color: #00ff00;} 50% {color: #00ff80;} 60% {color: #00ffff;} 70% {color: #0080ff;} 80% {color: #0000ff;} 90% {color: #8000ff;} 100% {color: #ff0080;} } </style> <div class="logo"> rainbowtext! fear me! :d </div>
.logo { font-size: 100px; margin-top: 10px; margin-bottom: 5px; margin-right: auto; margin-left: auto; color: #ff006e; transition: color 2s; }
the transition
inside div
trick!
Comments
Post a Comment