HTML: <embed> tag
In this series of learning HTML, we will teach you how to use the HTML embed tag with proper syntax and lots of examples. Let’s start on the HTML embed tag.
Description of HTML embed tag
The HTML embed tag is an HTML5 element that is used as a container for external resources, such as a picture, a webpage, a media player, or a plugin-in application. Due to compatibility issues, it’s better to use an HTML object tag.
Syntax of HTML embed tag
The proper syntax for the HTML embed tag is as shown below:
<body>
<embed type="application/x-shockwave-flash" src="into.swf" width="600" height="500">
<embed type="image/jpg" src="pic_logo.jpg" width="400" height="400">
<embed type="text/html" src="home.html" width="400" height="200">
<embed type="video/webm" src="video-intro.mp4" width="500" height="400">
</body>
Global Attributes
HTML embed tag is a part of Global Attributes.
Event Attributes
HTML embed tag is a part of Event Attributes.
Attributes
In expansion to the Global Attributes, the following is a list of attributes that are specific to the HTML embed tag:
Attribute | HTML Compatibility | Description |
---|---|---|
height | HTML5 | The height attribute specifies the height of the embedded content. |
src | HTML5 | The src attribute specifies the address of the embedded content. |
type | HTML5 | The type attribute specifies the media type of the embedded content. |
width | HTML5 | The width attribute specifies the width of the embedded content. |
Note
The HTML embed tag comes inside the HTML body tag.
HTML embed tag used only in HTML5, and for HTML4 and XHTML we need to use HTML object tag.
ActiveX, Java Applets, and Shockwave flash are no longer supported by any browsers.
To embed a picture use the HTML img tag, and to embed an HTML doc use the HTML iframe tag.
Browser Compatibility
The HTML embed tag has essential support with the following browsers:
- Chrome
- Internet Explorer (IE)
- Opera
- Safari (WebKit)
- Firefox (Gecko)
- Android
- Firefox Mobile (Gecko)
- Edge Mobile
- Opera Mobile
- Safari Mobile
Examples of HTML embed tag
We will discuss the HTML embed tag below, with some examples of how to use the embed tag in HTML5, HTML 4.01 Transitional, XHTML 1.0 Strict, XHTML 1.0 Transitional, and XHTML 1.1.
HTML 4.01 Transitional Document
You can’t use the HTML embed tag in HTML 4.01. Please use the HTML object tag instead.
XHTML 1.0 Transitional Document
You can’t use the HTML embed tag in XHTML 1.0 Transitional. Please use the HTML object tag instead.
XHTML 1.0 Strict Document
You can’t use the HTML embed tag in XHTML 1.0 Strict. Please use the HTML object tag instead.
XHTML 1.1 Document
You can’t use the HTML embed tag in XHTML 1.1. Please use the HTML object tag instead.