Path // www.yourhtmlsource.comReference → <EMBED> ELEMENT

<embed> element


The <embed> element embeds external content at a specified point in the document. This content is provided by an external application or other source of interactive content such as a browser plugin. It is a void element (self-closing) that was historically used for Flash and other plugins, but now is primarily used for embedding PDFs or SVG content.

Clock This page was last updated on 2025-11-17



Syntax

The <embed> element is a void element:

<embed src="document.pdf" type="application/pdf" width="600" height="400">

Key Attributes

  • src — The URL of the resource being embedded.
  • type — The MIME type of the embedded content. Helps the browser determine how to handle the content.
  • width — The display width of the embedded content in pixels.
  • height — The display height of the embedded content in pixels.

Any other attributes with non-empty values are passed to the plugin or external application as parameters.

Examples

Embedding a PDF Document

<embed
  src="manual.pdf"
  type="application/pdf"
  width="800"
  height="600">

Most modern browsers have built-in PDF viewers that will display the document inline.

Embedding an SVG File

<embed
  src="diagram.svg"
  type="image/svg+xml"
  width="500"
  height="400">

Embedding SVG files allows them to be interactive and styled independently of the main document.

Embedding External Content

<embed
  src="interactive-chart.html"
  type="text/html"
  width="100%"
  height="500">

While possible, using <iframe> is generally preferred for embedding HTML content.

When to Use

Modern Usage:

  • Embedding PDF documents for inline viewing
  • Displaying SVG graphics that need to maintain their own document structure
  • Integrating content that requires external handlers

Limitations and Considerations:

  • No fallback content — if the browser cannot display the content, nothing appears
  • Limited accessibility support compared to native HTML elements
  • Security concerns when embedding content from untrusted sources
  • Browser support and behavior can vary
  • Consider using <object> instead, which supports fallback content

Alternatives to Consider:

  • For video: Use <video> element
  • For audio: Use <audio> element
  • For HTML documents: Use <iframe> element
  • For SVG: Consider inline SVG or <img> element
  • For PDFs: Consider <object> with fallback download link
  • <object> — Embeds external content with fallback support
  • <iframe> — Embeds another HTML document
  • <video> — Embeds video content
  • <audio> — Embeds audio content
  • <img> — Embeds images