| Depr. | Empty | Version |
|---|---|---|
| No | Yes | N/A |
| IE5.5+ | FF1+ | SA1.3+ | OP9.2+ | CH2+ |
|---|---|---|---|---|
| Full | Full | Full | Full | Full |
Syntax
Description
embed is a
non-standard but well-supported element that’s used to embed multimedia
content, including media types that mightn’t usually be natively supported
by the browser. It can also be used for embedding media types that
are supported, such as images in .jpg,
.gif, or .png
format.
embed isn’t part of any
currently recognized standard (it is included in HTML5 which is
not yet finalized), so if you use it, your page can’t possibly
validate; to create valid markup, you’ll need to use the object element, which was
defined in HTML 4. That said, using embed is widely
recognised as a good way to embed Flash in an accessible manner, and many
believe that it’s acceptable to compromise validity for the sake of
accessibility.
embed won’t work for formats that
are natively supported in the browser, such as HTML and images—use the
built-in, properly supported mechanisms for such formats. The formats that
embed supports are generally restricted to those that
would require an additional plugin in order to work.
Although
embed is an empty element, an end tag is still required
for the sake of browser compatibility.
Example
In this example, a super-simple
embed element is used to display a video file in
.mp4 format:
<embed src="volksworld-video-report.mp4"> </embed>
Use This for…
This element is used for media files (primarily movie files, such as Flash and QuickTime video).
Compatibility
| Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 8.0 | 1.0 | 1.5 | 2.0 | 3.0 | 3.5 | 1.3 | 2.0 | 3.1 | 4.0 | 9.2 | 9.5 | 10.0 | 2.0 |
| Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full |
This element is very
well supported in current browsers, and has been supported in Netscape
Navigator and Internet Explorer as far back as versions 2 and 3,
respectively. Therefore, it has a longer heritage than the relative
‘newcomer’, the object element, and refuses to
disappear. The fact that very high profile video-sharing web sites like
YouTube promote embed markup as a mechanism for users
to share and embed videos into web pages means that this high level of
support is highly unlikely to wane in the immediate future. It’s for these
kind of reasons that the next version of HTML (HTML5) includes it in the
standard. (The phrase "paving the cowpaths" is often used in this
scenario, meaning “everyone’s using it this way anyway, so we may as well
just accept it and make it official”.)
In this Section
- align
alignment/position of the embed content relative to surrounding content - alt
alternative text for embed content - border
sets border thickness around the embed content - height
sets the embed content’s height - hidden
Sets the embed content to be invisible - hspace
sets amount of space horizontally (either side) for the embedded content - name
name for referencing the embed element by - pluginspage
defines the location for required plug-in - type
defines the MIME type for the embed content - vspace
sets amount of space vertically (top and bottom) for the object
User-contributed notes
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.