When to use embed instead of img, video, audio etc?


I’m currently working through the semantic HTML section and have come across the embed option which seems like a more diluted version of inputting video/audio/images etc

Why/when would I use embed instead of the img or video tags etc?


1 Like

This is my personal opinion, but just don’t use it.

We used to make use of it to embed stuff like Flash and media, but not so much anymore.

We now have dedicated tags, which we should use.

For example, you could use <div role="article"> to indicate an article, but since we now have <article>, why keep using the former?

You could use <embed type="video/quicktime">, but why not use <video> instead?

It’s good to know that it exists, but nowadays I can’t think of a meaningful use for it.

Oh btw, welcome to the forums Jared! Hope you like it here :slight_smile:


Excellent, I did think it felt a bit redundant - thanks!

MDN documentation (link) even advises against using embed:

Keep in mind that most modern browsers have deprecated and removed support for browser plug-ins, so relying upon <embed> is generally not wise if you want your site to be operable on the average user’s browser.

Embedding still happens, a very common example is embedding a youtube video on your website (while the video is hosted on youtube), but for this an <iframe> is used.