How to make a simple carousel in CSS or Javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to make a simple carousel in CSS or Javascript

I would like to make a very simple carousel with some image for a school project, but I don't event know where to start. I may try with the <table> HTML tag but that doesn't sense to me... Have you guys have some example or idea?

20th Feb 2021, 4:24 PM
Signor Gatto
Signor Gatto - avatar
2 Answers
+ 1
You can try to use @keyframes animation in CSS for that! For instance: index.html <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="style.css"/> </head> <body> <img src="Horse.png" alt="Horse" id="horse"> </body> </html> style.css @keyframes horsemove{ 0%{ margin-top:10%; margin-left:10%; } 10%{ margin-top:20%; margin-left:0%; } /*etc etc... Make the margin attributes on your own!*/ } #horse{ animation:horsemove 3s linear infinite; }
21st Feb 2021, 11:22 AM
TheCoder
20th Feb 2021, 4:33 PM
Matias
Matias - avatar