The <embed>
tag embeds external sources into a web page.
It is mostly used to embed images, videos, or PDF files.
This <embed>
tag embeds a PDF document in the page.
<embed src="/media/contract.pdf" type="application/pdf"
style="width:100%;height:500px;">
Tip: PDF documents can also be embedded with <object> and <iframe> tags.
The <embed>
tag embeds 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.
An <embed>
element. It embeds an image.
<embed src="/img/html/vangogh-bedroom.jpg">
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:
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.
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, they 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 |
Here is when <embed>
support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |