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 the src 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>

Share:
11,175
Fane
Author by

Fane

Updated on June 04, 2022

Comments

  • Fane
    Fane almost 2 years

    I've been trying to get a way of showing both gifs and videos (.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 a gif or video 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?