Use CSS Animation to Change the Hover State of a Button

Tell us what’s happening:

Hello, I wonder if someone can help me. I’m trying to complete this challenge. This is what i’m trying to do.

Use CSS @keyframes to change the background-color of the button element so it becomes #4791d0 when a user hovers over it. The @keyframes rule should only have an entry for 100%.

Below is my code below. When I try and execute it, I get this error

// running test
The @keyframes rule should use the animation-name background-color.
There should be one rule under @keyframes that changes the background-color to #4791d0 at 100%.
// tests completed

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;
    background-color: #4719d0
  }

  @kyframes background-color {
    100%
    
   background-color: #4791d0;
  }
  
  
</style>
  
<button>Register</button>

Would there be someone available to help me spot check my code? I've tried looking it up, but haven't had any luck. I would apprecaite  any help anyone can offer, thank you.

Sincerely,

Mark Scott Benson

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/applied-visual-design/use-css-animation-to-change-the-hover-state-of-a-button/

1 Like

You misspelled @keyframes.

There should also be a pair of braces after 100%. The background-color property should then be inside them.

@keyframes background-color { 100% {
background-color: #4791d0; }

1 Like

Heres some cool button animation on hover https://newtodesign.com/17-css-3d-buttons/