Animation-fill-mode VS. transition

Tell us what’s happening:

If I can accomplish the same thing with less code like so:


button:hover {
    background-color:#4791d0;
    transition:500ms;
}

Why am I setting @keyframes and using animation properties? The expected solution seems overly complex.

Your code so far



<style>
  button {
    border-radius: 5px;
    color: white;
    background-color: #0F5897;
    padding: 5px 10px 8px 10px;
  }
  button:hover {
    animation-name: background-color;
    animation-duration: 500ms;
    /* add your code below this line */
    animation-fill-mode:forwards;
    /* add your code above this line */
  }
  @keyframes background-color {
    100% {
      background-color: #4791d0;
    }
  }
</style>
<button>Register</button>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6.

Link to the challenge:

Don’t use animation when you dont need it)
Animation gives you more control over keyframes