Create Movement Using CSS Animation: Left-off set bugging

Tell us what’s happening: Hello, I am having an issue with fulfilling the second specification: @keyframes= ‘50%’. I get this response: The @keyframes rule for 50% should use the left offset of 25px; even when I have used the left off-set of “25px;”.

Your code so far


<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;
    left: 0px;
    
  }
  50% {
    background-color: green;
    top: 0px ;
    left: 25px;
  }
  100% {
    background-color: yellow;
    top: 0px;
    left:-25px;
    
  }
}
</style>

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

Your browser information:

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

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

If you read it carefully the challange asks you to:
" Using the left offset property, add to the @keyframes …`

1 Like

I had accidentaly changed the 50% top-value from 50%; which was what caused the bug.

:smile: Thanks for the help.