Can i use <animate> with a <img src> ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Can i use <animate> with a <img src> ?

i would like to make a image move in the page

13th Jan 2018, 2:40 PM
Arthur Abreu
Arthur Abreu - avatar
4 Answers
+ 3
You have to use the <marquee> tag.
13th Jan 2018, 2:42 PM
Robyn A
Robyn A - avatar
+ 16
It would be better if you use css. Marquee is deprecated.
13th Jan 2018, 4:08 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 4
@Robyn_A: Actually <marquee> still works in most of browsers, even in an html5 document... The trick is that <marquee> had never been part of html specification, and html5 specification discourage it use and implementation, meaning that it should becomes unsupported by mostly browsers in future ^^ @Arthur Abreu: <animate> is not part of HTML standard, but part of SVG one: it can only be used in <svg> container... However, <svg> can hold image (as background of SVG shapes, so <img> in html is quite equivalent to <rect> in svg with background-image, even if svg is not design to handle bitmaps at first) and you can use <animate> as child of it. Anyway, @Swapnil Srivastava is right, using css animation features should be the better way to do ;)
13th Jan 2018, 6:27 PM
visph
visph - avatar
+ 1
@Swapnil Thanks, I forgot that even though <marquee> works in the code playground, it doesn't work in HTML5.
13th Jan 2018, 4:26 PM
Robyn A
Robyn A - avatar