Create Movement Using CSS Animation-am I still off?

what am I missing here? says to keep top, I have all the numbers correct. But it says I’m wrong still. Forums give say I’m correct but it’s not passing it. Am I still wrong?


<style>
  div {
    height: 40px;
    width: 70%;
    background: black;
    margin: 50px auto;
    border-radius: 5px;
    position: relative;

  }

#rect {
  animation-name: rainbow;
  animation-duration: 4s;

}

@keyframes rainbow {
  0% {
    background-color: blue;
    top: 0px;
    
  }
  50% {
    background-color: green;
    top: 25px;
    
  }
  100% {
    background-color: yellow;
    top: -25px;
    
  }
}
</style>

<div id="rect"></div>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/applied-visual-design/create-movement-using-css-animation/

you are adjusting the “top” rule. You should add a “left” rule to each frame with the given pixel values and leave the “top” rule as is.

@keyframes rainbow {
  0% {
    background-color: blue;
    top: 0px;
    left: 0px;
  }
  50% {
    background-color: green;
    top: 25px;
    left: 25px;
  }
  100% {
    background-color: yellow;
    top: 0px;
    left: -25px;
  }
}
1 Like

ohhhhhhh! ok, I think I understand now! Taking another go. :slight_smile:

I tried this as well but it kept failing me, not sure what I was doing wrong as it could be as simple as forgetting the ;
This finally worked but with 50% top still at 50px and then left 25px

Thank you for the help!

1 Like

Thank you for the oppertunity

1 Like