totn HTML

HTML: <embed> tag

This HTML tutorial explains how to use the HTML element called the <embed> tag with syntax and examples.

Description

The HTML <embed> tag is an HTML5 element that is used as a container to embed external content such as an external application or a browser plug-in. Due to compatibility issues, the <object> tag is more commonly used to embed resources than the <embed> tag. This tag is also commonly referred to as the <embed> element.

Syntax

In HTML, the syntax for the <embed> tag is:

<body>
<embed type="application/x-shockwave-flash" src="movie.swf" width="400" height="300">
</body>

Attributes

In addition to the Global Attributes, the following is a list of attributes that are specific to the <embed> tag:

Attribute Description HTML Compatibility
height Height to display the resource in pixels HTML5
src URL of the resource to embed HTML5
type MIME type of the plug-in for the resource HTML5
width Width to display the resource in pixels HTML5

Note

  • The HTML <embed> element is found within the <body> tag.
  • Since the <embed> tag is only available in HTML5, use the <object> tag for HTML4 or XHTML.

Browser Compatibility

The <embed> tag has basic support with the following browsers:

  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • Edge Mobile
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example

We will discuss the <embed> tag below, exploring examples of how to use the <embed> tag in HTML5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.