Tag embed

The <embed> tag is used to embed external content such as multimedia (videos, audio), PDFs, or interactive applications (like Flash, SVG, or other plugins) directly into a webpage.

It acts as a container for non-HTML content.


✅ Basic Syntax

<embed src="file.pdf" type="application/pdf" width="600" height="500">

📍 Result:
Displays a PDF document embedded within the webpage.


🧩 Common Uses

Content TypeMIME Type
PDF documentapplication/pdf
MP3 audioaudio/mpeg
MP4 videovideo/mp4
SVG imagesimage/svg+xml
Flash (deprecated)application/x-shockwave-flash

🎨 Example: Embedding a YouTube Video

While YouTube prefers <iframe>, here’s how you could use <embed> (not recommended nowadays):

<embed 
src="https://www.youtube.com/v/VIDEO_ID"
width="560"
height="315"
type="application/x-shockwave-flash">

⚠️ Note: Flash is now deprecated, and this method is outdated. Use <iframe> for YouTube embeds.


⚙️ Attributes of <embed>

AttributeDescription
srcPath to the external file/resource
typeMIME type of the content
widthWidth of the embedded content
heightHeight of the embedded content

⚠️ Important Notes

  • The <embed> tag is self-closing (no closing tag).
  • It’s supported in all modern browsers.
  • For multimedia, <video> and <audio> are now preferred over <embed> due to better control and accessibility.
  • Not all file types are embeddable — depends on the browser and OS support.

✅ Summary

Tag<embed>
PurposeEmbed external, non-HTML content
Semantic?❌ No
Common UsesPDFs, SVGs, media, plugins
Alternatives<iframe><object><video>