How to specify a time in the color change with: hover?

6
<a href="#">link</a>

a:hover{
 color:blue;
}

With this script I can change the color of the text "link" when the mouse passes over, but the color changes instantly. I wanted the color change to be smooth, a little slow. How do I do this?

    
asked by anonymous 31.08.2018 / 23:57

1 answer

5

Just use transition :

transition: color .7s;

              ^    ^--- tempo que vai durar
              |
               -- propriedade que quer suave

Warning for a detail: In your case (and most of them) you will apply transition to the original item, not affected by :hover .


If you want with images, you have an example here:

  

Transition with fade between sprites p>


Demonstration:

a{
  color:red;
  transition: color .7s;
}

a:hover{
  color:blue;
}
<a href="#">Faça o hover aqui neste link</a>
    
01.09.2018 / 00:20