Use GIFs in <video> tag, or use videos in <img> tags
11,175
According to MDN
The HTML
<video>
element is used to embed video content. It may contain several video sources, represented using thesrc
attribute or the element; the browser will choose the most suitable one.
Therefore gif
- not a video content - is NOT an option to be used in <video>
tag
Here is the list of supported formats for <video>
and <audio>
Author by
Fane
Updated on June 04, 2022Comments
-
Fane almost 2 years
I've been trying to get a way of showing both
gif
s andvideo
s (.mp4
,.ogg
,.webm
) within the same tag.So, if it is within a
<video>
tag I would only change the source or the<source>
to agif
orvideo
and show it accordingly.Unfortunately I'm not finding anything consensual that would allow doing this.
Does anyone got a simple solution before I move on to the hardest ones?