Hello! What is wrong with my code? I want a square that goes left by 50px, then right by 9px, then left 20px. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello! What is wrong with my code? I want a square that goes left by 50px, then right by 9px, then left 20px.

#square { width: 100px; height: 100px; background-color: red; position: relative; } @keyframes square { 0% { background-color: blue; top: 0px; left: 50px; } 50% { background-color: black; top: 0px; right: 9px; } 100% { background-color: red; top: 0px; left: 20px; } }

25th Nov 2018, 8:56 PM
Eric
Eric - avatar
3 Answers
+ 4
Eric as D'lite said, use body tag. Its necessary to display anything on your webpage.
25th Nov 2018, 11:36 PM
Arushi Singhania
Arushi Singhania - avatar
+ 1
**NOTE: This is my HTML: <html> <head> <title> Fun With CSS </title> </head> <body> <div id="square"></div> </body> </html> Use this markup
25th Nov 2018, 10:44 PM
Dlite
Dlite - avatar
0
**NOTE: This is my HTML: <html> <head> <title> Fun With CSS </title> </head> <div id="square"></div> </html>
25th Nov 2018, 8:57 PM
Eric
Eric - avatar