HTML - <embed> Tag



The HTML <embed> tag is used as a container for external applications, multimedia, and interactive content that the browser doesn't understand.

For proper presentation, special programs or external plug-ins must be attached. The file type, attribute of the <embed> tag, and installed browser plugins all play a role in how embedded content is displayed.

Although HTML5's introduced the <audio> and <video> elements specifically for embedding multimedia in HTML documents, the <embed> element can still be used to incorporate both third-party applications and multimedia content.

Syntax

Following is the syntax of the HTML <embed> tag −

<embed src=" " ></embed>

Attributes

HTML embed tag supports both Global and Event attributes of HTML. It also accepts some specific attributes, which are listed below.

Attribute Value Description
height pixels Specifies the height of embedded content.
src URL Specifies the URL of the embedded content.
type MIME_type Specifies the MIME type of embedded content.
width pixels Specifies the width of embedded content.

Example: Embedding image

The examples will illustrate the usage of the HTML <embed> tag, including where, when and how to use it to embed images, HTML pages, videos, or audio. Lets look at a basic example where we embed an image on a webpage. However, we recommend using the <img> tag to display images −

<!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>

Example: Embedding audio

The following example demonstrates how to use the HTML <embed> tag to place audio on a webpage. However, we recommended using the <audio> tag to display audio −

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

Example: Embedding video

Consider another scenario where we use the HTML <embed> tag to embed a video. Howevr, we recommended using the <video> tag to display video −

<!DOCTYPE html>
<html>
<body>
   <embed type="video/webm" 
          src=
"https://www.youtube.com/embed/9ZXZFVZviK4?si=D04mP_FPlyQTl6tL"
          width="400" height="300">
</body>
</html>

Example: Embedding HTML Page

Consider another scenario where we use the HTML <embed> tag to embed an HTML page. However, we recommend using the <iframe> tag to display an HTML page −

<!DOCTYPE html>
<html>
<body>
   <embed type="text/html" src="/index.htm" width="500" height="200">
</body>
</html>

Supported Browsers

Tag Chrome Edge Firefox Safari Opera
embed Yes Yes Yes Yes Yes
html_tags_reference.htm
Advertisements