Create Movement Using CSS Animation (uche)

Tell us what’s happening:

Hi everyone… My code doesn’t seem to pass all the tests. Please, can someone help me look at it.

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 (Windows NT 6.1; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0.

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

Hi @ucheg6,

Your code is right, but some times code didn’t work in some browsers, so try another browser like Firefox or Chrome.

Also, here is my solution work in Chrome browser:

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

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

Hope this help you, good luck my friend.

Regards,
Ali Mosaad

2 Likes

Thanks Ali. I will check it out on chrome

1 Like

Good luck my friend :+1: , and if you have any question, just ask it and i will be in touch with you.