HTML / HTML Tags

HTML <Embed> Tag

Dec 12, 2022
2 min read
HTML embed Tag

Definition

The <embed> tag is used to embed external resources into an HTML document, such as an image, web page, audio file, or video file.

Example

<!--Embed an imgsrc:-->
<embed
  type="image/jpg"
  title="storm"
  src="https://res.cloudinary.com/thewebmaster/image/upload/ar_16:10,c_fill,f_auto,g_auto,q_auto,w_300/image/google-update-march-2017.jpg"
  width="300"
  height="188"
/>

<!--Embed a HTML page:-->
<embed
  type="text/html"
  title="The Webmaster"
  src="https://www.thewebmaster.com/"
  width="500"
  height="200"
/>

<!--Embed a movie file:-->
<embed type="video/webm"
  src="https://file-examples-com.github.io/uploads/2020/03/file_example_WEBM_1920_3_7MB.webm"
  width="250"
  height="200"
  title="The Earth"
/>

Usage

  • For the <embed> element to display correctly, you will need to add the type, src, width, and height attributes.
  • The <embed> element must have an opening tag but must not have a closing tag.
  • Most browsers no longer support Java Applets and Plug-ins, ActiveX controls, or Flash.

Attributes

The <embed> element supports the Global Attributes, as well as the following.

Best Practices

  • While using <embed> tags to embed images, html documents, video, and audio is perfectly valid HTML5, it is better to use other semantic elements. For example:
    • Use <img> to display an image.
    • Use <iframe> to embed a html or pdf document in the page.
    • Use <video> to display a video.
    • Use <audio> to display audio.
  • There is better support in browsers for <video> and <audio> controls. For example the autostart control may require different markup required in different browsers.
  • You should use a <title> attribute to aid assistive technologies such as screen readers.

Specification

Browser Support

Desktop

ChromeEdgeFirefoxIEOperaSafari
YesYesYesYesYesYes

Mobile

Android WebviewChrome AndroidFirefox AndroidOpera AndroidiOS SafariSamsung Internet
YesYesYesYesYesYes