HTML <embed> Tag

The <embed> tag is used as a container for external applications, multimedia and interactive content that the browser doesn’t understand. External plug-ins or special programs must be connected for their proper display. The display of the embedded content depends on the file type, the attributes of the <embed> tag, and the plugins installed in the browser.

Although supported by the browsers, the <embed> is a deprecated HTML tag and is not part of the HTML4 standard.

To load objects into HTML4, use the <object> tag. But since not all browsers correctly display the information it contains, we use the <embed> tag inside the <object> container to provide support of more browsers, as well as the validity of the document. Since the <embed> tag is one of the HTML5 elements, there are no problems with the validation of the document in HTML5.

Use the CSS object-position property to correct the positioning of the embedded object within the element’s frame.

Syntax

The <embed> tag is empty, which means that the closing tag isn’t required. But in XHTML, the (<embed>) tag must be closed (<embed/>).

Example of the HTML <embed> tag for placing a logo:

<!DOCTYPE>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <embed src="/uploads/media/default/0001/01/0710cad7a1017902166203def268a0df2a5fd545.png" />
  </body>
</html>

Result

embed tag example

Example of the HTML <embed> tag for placing a audio:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <embed type="audio/mpeg" 
      src="/build/audios/audio.mp3" 
      width="200"
      height="100">
  </body>
</html>

Example of the HTML <embed> tag for placing a video:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <embed type="video/ogg" 
      src="/build/videos/arcnet.io(7-sec).mp4" 
      width="300" 
      height="200" 
      title="Arcnet.io video">
  </body>
</html>

Attributes

Attribute Value Description
align Specifies the alignment of the embedded content on the page and the way it is wrapped around the text.
left Aligns to the left.
right Aligns to the right.
center Aligns the center.
justify Aligns to the right and left edges.
height pixels Defines the height of the embedded content.
pluginspage URL Address, from where we can download and install necessary plug-in.
src URL Indicates the path to the file which will be inserted in the <embed> tag.
type MIME-type Defines the MIME type (specification for the transmission over the network of files of various types) of the embedded content.
vspace pixels Defines the vertical indent from the embedded content to the surrounding one.
width pixels Defines the width of the embedded content.

The <embed> tag supports the Global attributes and the Event Attributes.

Browser support

chrome edge firefox safari opera

Practice Your Knowledge

What are the use-cases of the HTML <embed> tag?

Quiz Time: Test Your Skills!

Ready to challenge what you've learned? Dive into our interactive quizzes for a deeper understanding and a fun way to reinforce your knowledge.

Do you find this helpful?