Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play Gif image in HTML with infinite loop

I tried displaying a gif animated image inside my HTML code like

<img src="preview.gif" loop=infinite />

With or without the loop tag , it always plays once only.

Any help to make it loop continuously?

like image 229
Bialy Avatar asked Nov 09 '16 00:11

Bialy


People also ask

How do I loop a GIF in HTML?

<img loop=""> Attribute: Make Videos Loop In Your HTML Previously used to specify the number of times a video should play, when used in conjunction with the dynsource attribute.

How do I set my GIF to play on loop?

Click Animation from the menu at the top. Click Edit GIF Animation. Click the drop-down menu next to Looping and choose how many times you want the GIF to loop. Click Apply.


1 Answers

Looping is encoded into the GIF itself, not the img tag. Open the GIF in an image editor and change the mode to loop, or use a different GIF. The loop attribute is an invalid, deprecated attribute only meant to work when the src is a video.

like image 167
Andy Ray Avatar answered Sep 17 '22 21:09

Andy Ray