HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<embed> (Embedded Object)

This widely supported but nonstandard element specifies an object, typically a multimedia element, to be embedded in an HTML document.

Proprietary Syntax (Commonly Supported)

accesskey="key" (5.5)
align="absbottom | absmiddle | baseline | bottom |
left | middle | right | texttop | top" (4)
alt="alternative text" (4)
class="class name(s)" (4)
code="filename" (4)
codebase="url" (4)
height="pixels" (4)
hspace="pixels" (4)
id="unique alphanumeric identifier" (4)
language="javascript | jscript | vbs | vbscript | xml" (5.5)
name="string" (4)
src="url" (4)
style="style information" (4)
title="advisory text" (4)
unselectable="on | off" (5.5)
vspace="pixels" (4)
width="pixels" (4)

Attributes Defined by Netscape

border="pixels" (4)
hidden="true | false" (4)
palette="background | foreground" (4)
pluginspage="url" (4)
type="mime type" (4)
units="en | pixels" (4)

Events Defined by Internet Explorer

onactivate, onbeforeactivate, onbeforecut, onbeforedeactivate, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncut, ondeactivate, onfocus, onfocusin, onfocusout, onhelp, onload, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onscroll

Element Specific Attributes

This attribute controls the alignment of adjacent text with respect to the embedded object. The default value is left.

This attribute indicates the text to be displayed if the applet cannot be executed.

This attribute specifies the size in pixels of the border around the embedded object.

This attribute specifies the name of the file containing the compiled Java class if the <embed> element is used to include a Java applet. This is a strange alternate form of Java inclusion documented by Microsoft.

This specifies the base URL for the plug-in or potential applet in the case of the alternative form under Internet Explorer.

This attribute sets the height in pixels of the embedded object.

If this attribute is set to the value true, the embedded object is not visible on the page and implicitly has a size of zero.

This attribute specifies in pixels the size of the left and right margins between the embedded object and surrounding text.

This attribute specifies a name for the embedded object, which can be referenced by client-side programs in an embedded scripting language.

This attribute is used only on Windows systems to select the color palette used for the plug-in and might be set to background or foreground. The default is background.

This attribute contains the URL of instructions for installing the plug-in required to render the embedded object.

This attribute specifies the MIME type of the embedded object. It is used by the browser to determine an appropriate plug-in for rendering the object. It can be used instead of the src attribute for plug-ins that have no content or that fetch it dynamically.

This Netscape-specific attribute is used to set the units for measurement for the embedded object either in en or in the default, pixels.

This attribute specifies in pixels the size of the top and bottom margins between the embedded object and surrounding text.

This attribute sets the width in pixels of the embedded object.


<!-- embed without a close tag -->
<embed src="" height="150" width="150">
<img src="testgif.gif" height="150" width="150" alt="Test Image">

<!-- embed with a close tag -->
<embed src="" height="150" width="150">
<img src="testgif.gif" height="150" width="150" alt="Test Image">


No Standards Internet Explorer 3, 4, 5, 5.5, 6
Netscape 2, 3, 4 - 4.7
Opera 4-7


It is actually unclear whether or not the close tag for <embed> is required. Many sites tend not to use it, and documentation is not consistent. Some people claim that a close tag is required and should surround any alternative content in a noembed element; others do not use a close tag. Whatever the case, this element should be phased out in favor of object, so this might be a moot issue.

The embed element is not favored by the W3C and is not part of any official HTML or XHTML specification; however, it is very common. The HTML specification says to use the object element, which can be used in conjunction with the embed element to provide backward compatibility. See Chapter 15 for examples.

Embedded objects are multimedia content files of arbitrary type that are rendered by browser plug-ins. The type attribute uses a file's MIME type to determine an appropriate browser plug-in. Any attributes not defined are treated as object-specific parameters and are passed through to the embedded object. Consult the plug-in or object documentation to determine these. The standard parameters supported by the Microsoft implementation are height, name, palette, src, units, and width.

(X)HTML Elements
CSS Properties
Previous: em Next: fieldset
< Home | About | Chapters | Examples | Errata | Reference | Site Map >