HTML - <embed> Tag



The <embed> tag is used as a container for external applications, multimedia, and interactive content that the browser don't understand. For their proper presentation, special programs or external plug-ins must be attached. The file type, attribute of the <embed> tag, and browser plugins installed all have a role in how embedded content is displayed.

Although HTML5's newly added <audio> and <video> elements are specifically used to embed multimedia in HTML documents, the <embed> element can be used to incorporate both third-party apps and multimedia content.

Syntax

Following is the syntax of <embed> tag −

<embed src=" " ></embed>

Specific Attributes

The HTML <object> tag also supports the following additional attributes −

S.No. Attribute Value & Description
1 height

pixels

Specifies the height.

2 src

URL

Specifies the address of the source file.

3 type

MIME_type

Specifies the MIME type.

4 width

pixels

Specifies the width.

Example

Let’s look at the basic example where we are going to embed an image on the webpage.

<!DOCTYPE html>
<html>
<head>
   <style>
      h2 {
         color: #DE3163;
      }
      p {
         color: #7D3C98;
         font-style: verdana;
      }
   </style>
</head>
<body>
   <embed src="https://www.tutorialspoint.com/cg/images/logo.png" height="30" width="200"></embed>
   <h2>Welcome To The TutorialsPoint</h2>
   <p>The Best E-Way Learning</p>
</body>
</html>

When we execute the above code, it will generate an output consisting of the image along with text embedded on the webpage.

Example

Following is an example where we are going to use the HTML <embed> tag to place audio on the page.

<!DOCTYPE html>
<html>
<body style="background-color:#EAFAF1 ">
   <embed type="audio/mpeg" src="https://samplelib.com/lib/preview/mp3/sample-3s.mp3">
</body>
</html>

On running the above code, the output window will pop up, displaying the audio file displayed on the webpage.

Example

Consider another scenario where we are going to use the HTML <embed> tag to embed a video.

<!DOCTYPE html>
<html>
<body>
   <embed type="video/webm" src="https://cdn.pixabay.com/vimeo/862152022/bees-179480.mp4?width=640&hash=2e72975d6d298e9d485126a9260f5f539eb13337" width="400" height="300">
</body>
</html>

When we execute the above code, it will generate an output consisting of a video uploaded to the webpage.

html_tags_reference.htm
Advertisements