The <embed> tag in HTML is used to embed external content or media files (such as audio, video, or interactive elements like Flash) directly into a webpage.
- It is a self-closing tag
- It is often used for embedding files like PDFs, images, or other types of media that require a plugin or external application to display.
<!DOCTYPE html>
<html>
<head>
<title>embed Tag</title>
<style>
q {
color: #00cc00;
font-style: italic;
}
</style>
</head>
<body>
<p> <q>GeeksforGeeks</q> is loading.</p>
<br>
<embed src="loading2.swf"
type="application/x-shockwave-flash">
</body>
</html>
Syntax
<embed src="URL" type="MIME_type" width="width_value" height="height_value">Attributes
Attribute Values | Description |
|---|---|
This attribute contains the attribute value in pixels. It is used to specify the height of the embedded content. | |
It is used to hold the URL. It is used to specify the web address of the embedded content. | |
The width value is set in pixels. It is used to specify the width of embedded content. | |
It contains the media_type content. It is used to specify the media type of the embedded content. |
embedded PDF and video using <embed> Tag
<!DOCTYPE html>
<html>
<body>
<h2>Embed a PDF Document</h2>
<embed src="example.pdf" type="application/pdf"
width="400" height="200" />
<h2>Embed a Video</h2>
<embed src="example.mp4" type="video/mp4"
width="400" height="200" />
</body>
</html>