<embed>

The HTML <embed> element integrates external content, like multimedia or interactive applications, directly into a webpage, facilitating the inclusion of media without needing plugins.

embed tag

The <embed> HTML element allows external content to be embedded directly within a document. This content can originate from an external application or source, such as interactive elements provided by browser plugins.

Syntax

index.html
<embed src="url" type="mime-type" width="width" height="height">

embed Demo

  • An embedded image
  • An embedded HTML page
  • An embedded video

An embedded image

index.html
<embed type="image/jpg" src="pic_trulli.jpg" width="300" height="200">

An embedded HTML page

index.html
<embed type="text/html" src="snippet.html" width="500" height="200">

An embedded video

index.html
<embed type="video/webm" src="video.mp4" width="400" height="300">
  • The <embed> element is effective for integrating various types of media and interactive content directly into a webpage.

Explanation and Purpose

The <embed> element functions as a container for incorporating external resources, including web pages, images, media players, or other embedded applications.

  • Modern web browsers no longer support Java Applets and Plug-ins.
  • ActiveX controls are incompatible with current browsers.
  • Support for Shockwave Flash has been discontinued in recent browser versions.

Attributes

This element supports the global attribute.

AttributeValueDescription
heightpixelsSpecifies the height of the embedded content
srcURLSpecifies the address of the external file to embed
typemedia_typeSpecifies the media type of the embedded content
widthpixelsSpecifies the width of the embedded content
  • height: Defines the height of the embedded resource in CSS pixels. Only absolute values are allowed; percentages are not supported.
  • src: Specifies the URL of the embedded resource.
  • type: Indicates the MIME type to determine how the resource should be rendered.
  • width: Defines the width of the embedded resource in CSS pixels. Like height, only absolute values are accepted; percentages are not permitted.

Default CSS Settings

By default, the <embed> element is rendered with the following settings in most web browsers:

style.css
embed:focus {
  outline: none;
}

Accessibility

The title attribute can be used with the <embed> element to provide a description of its content. This helps users with assistive technologies understand the purpose of the embedded resource.

Conclusion

The <embed> tag in HTML is a versatile tool for integrating external content such as images, videos, and interactive media directly within a webpage. Key attributes like src, type, width, and height provide control over the embedded resource’s display. Although modern browsers no longer support certain outdated technologies like Java Applets and Flash.