<embed>

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

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/>).

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

Result

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

Attributes

AttributeValueDescription
alignSpecifies the alignment of the embedded content on the page and the way it is wrapped around the text.
leftAligns to the left.
rightAligns to the right.
centerAligns the center.
justifyAligns to the right and left edges.
heightpixelsDefines the height of the embedded content.
pluginspageURLAddress, from where we can download and install necessary plug-in.
srcURLIndicates the path to the file which will be inserted in the <embed> tag.
typeMIME-typeDefines the MIME type (specification for the transmission over the network of files of various types) of the embedded content.
vspacepixelsDefines the vertical indent from the embedded content to the surrounding one.
widthpixelsDefines the width of the embedded content.

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



请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部