HTML Tutorial: Complete HTML Tutorial
About Lesson

HTML <embed> Tag


Concept

The <embed> tag in HTML is utilized to embed content like images, videos, or other HTML pages within a web page. It’s a versatile tag that allows you to include various media types directly into your content. However, it’s essential to note that support for Java Applets, ActiveX controls, and Shockwave Flash has been discontinued in modern browsers.

Suggestion

  • To display a picture, it is better to use the <img> tag.
  • To display HTML, it is better to use the <iframe> tag.
  • To display video or audio, it is better to use the <video> and <audio> tags.

These suggestions provide more modern and widely supported alternatives to the <embed> tag for specific content types. Following these recommendations ensures that your embedded content is accessible to a broader audience across various browsers and devices.

Implementation

Sponsored by Google

Example 1: Embedding an Image

You can use the <embed> tag to embed an image within your web page:

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

Example 2: Embedding an HTML Page

To embed another HTML page within your current page, you can use the following code:

<embed src="page.html" type="text/html" width="800" height="600">

Example 3: Embedding a Video

You can also embed a video file using the <embed> tag:

<embed src="video.mp4" type="video/mp4" width="640" height="360">
Try it out below:
Loading

Warning: Most browsers no longer support Java Applets, Plug-ins, ActiveX controls, and Shockwave Flash. It’s better to use the <img> tag for images, the <iframe> tag for HTML, and the <video> or <audio> tags for videos and audio files.

Attributes


Attribute Value Description
height pixels Specifies the height of the embedded content
src URL Specifies the address of the external file to embed
type media_type Specifies the media type of the embedded content
width pixels Specifies the width of the embedded content
Global Attributes

The <embed> tag supports all the global attributes in HTML.

Event Attributes

The <embed> tag also supports all the event attributes in HTML.