HTML <embed> Tag

The <embed> tag embeds external content into a web page. Today, the embed element is mostly used to embed images, videos, and PDF files, but no third party plugins because of security concerns.




An <embed> tag.
This element embeds a PDF document into the page.

<embed src="/media/contract.pdf" type="application/pdf"

Tip: PDF documents can also be embedded with <object> and <iframe> tags.

Using <embed>

The <embed> tag embeds a variety of external sources into a web page.

It can embed images, videos, PDF files, third party applications, plugins, and more.

Because of security concerns, browsers are limiting the functionality of embed elements.

Note: ActiveX, Java Applets, and Plugins are disabled.

More Examples

An <embed> element. It embeds an image.

<embed src="/img/html/vangogh-bedroom.jpg">

As mentioned, modern browsers have deprecated and removed support for plugins.

For this reason, it may be best to avoid <embled> and use an alternative.

For embedding resources use any of the following tags:

  • <img> - displays images
  • <iframe> - displays embedded HTML pages or PDF documents
  • <audio> and <video> - plays audio or video sources respectively

Attributes for <embed>

The table below are the attributes used by <embed>.

Attribute Value Description
height pixels Height of embedded content in pixels
width pixels Width of embedded content in pixels
src URL Address or path of the file to embed
type media-type Media type of the file to embed
id    value Provides the embed element with a unique identifier.
class    classnames Assigns one or more classnames to the embed element.
style    CSS-values Assigns CSS style values to the embed element.

For additional global attributes see our global attributes list.

Media Tags

The <embed> tag is part of a group of tags that create multi-media experiences on the web. This group is referred to as the Media tag group. Together, these tags allow you to create powerful multi-media solutions.

Here is a list of media tags.

Element Description
<audio> Creates a player for sound such as music, sound effects, or others
<video> Creates a video player on a page
<source> Adds a media source for a <video>, <audio>, or <picture>
<track> Adds a text track, such as, subtitles and captions, to the media
<embed> Creates a container for an external resource
<iframe> Creates a frame in which another web page can be embedded
<svg> Displays an scalable vector image
<canvas> Creates a graphics container where JavaScript can draw
<img> Displays an image
<area> Specifies a map area for an image
<map> Defines a client-side image map, i.e. an image with clickable areas
<figure> Displays self-contained content, usually an image
<figcaption> Adds a caption to a <figure> (image) element

Browser support

Here is when <embed> support started for each browser:

1.0 Sep 2008
1.0 Sep 2002
1.0 Aug 1995
1.0 Jan 2006
1.0 Jan 2003

You may also like