This reference is built into PageRIJ — a live HTML, CSS & SVG authoring and learning environment.

HTML <embed> element

The <embed> element embeds external content into the document. It is a compact way to place a resource such as a PDF, SVG, media file, or other browser-handled content directly into the page.

The src attribute gives the address of the resource. The type attribute can state the resource's media type. The width and height attributes set the embedded area's dimensions in CSS pixels, using integers without unit suffixes. Support for a particular resource type depends on the browser and device.

The element is empty. It has no closing tag and no fallback content inside it. This is one of the main differences between <embed> and <object>.

The <embed> element is deliberately simple, but that simplicity has a cost. If the resource fails or the browser cannot handle it, there is no internal fallback paragraph or link waiting inside the element.

When the content is an ordinary image, use <img>. When the content is a video, use <video>. When the content is another page, <iframe> is often clearer. <embed> is most useful when the resource is external and less neatly described by those more specific elements.

Give the embedded resource a useful label and provide its description and a direct link nearby. That link remains available even if the browser cannot display the resource. The example uses a local SVG to demonstrate embedding; for an ordinary image on a page, <img> is usually the appropriate choice.

Attributes: src, type, width, height, GLOBALS.

Typical layout:
<embed src="examples/box-model-wide.svg"
  type="image/svg+xml" width="240" height="120"
  title="CSS box model">
<p>From outside in: margin, border, padding, content.</p>
<p><a href="examples/box-model-wide.svg">Open the diagram</a></p>
Visual representation:

From outside in: margin, border, padding, content.

Open the diagram