XML technologies / HTML & XHTML / Alphabetical list of HTML and XHTML elements / embed

(Excerpt from "HTML & XHTML ─ kurz & gut" by Jennifer Niederst Robbins)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

   

embed

HTML 5

<embed> ... </embed> (or <embed />)

Embeds an object in a web page. Embedded objects are usually multimedia files played through plugins, such as Flash or QuickTime movies. Besides the attributes below, particular media types and plugins provide proprietary attributes to control playback.

Notes

Although supported by most browsers, embed is not part of HTML 4.01 or earlier specifications. Embedded media should instead use the object element. Nevertheless, it was included in the HTML 5 working draft. Because it is supported but undocumented, embed has many browser- and media-specific attributes, and its syntax is unclear. For backward compatibility, many developers use object and embed together for one media object, although HTML 4.01/XHTML does not provide for this.

Start/end tag

Documentation conflicts about whether embed is a container element (<embed> ... </embed>) or an empty element
(<embed />). Most browsers appear to support both syntaxes. Using an end tag is generally considered safest. In HTML 5, embed is instead defined as an empty element.

HTML 5 attributes

Global HTML 5 attributes

  • height="Zahl"

    Specifies the element’s height in pixels. This attribute is mandatory for some media types.

  • src="URL"

    Specifies the location of the resource to embed in the page.

  • width="Zahl"

    Specifies the element’s width in pixels. This attribute is mandatory for some media types.

  • type="Medientyp (MIME)"

    Specifies the MIME type of the embedded media file so that the correct plugin can load. The file extension specified by the attribute src can also identify the correct plugin.

Nonstandard attributes

These attributes are widely supported but have never been included in an HTML specification:

  • align="left|right|top|bottom"

    While top and bottom control vertical alignment, left and right align the object with the left or right edge and allow text to wrap around it.

  • alt="Text"

    Contains alternative descriptive text if the media object cannot be displayed (similarly to the img element).

  • hidden="yes|no"

    Hides playback controls when hidden has the value yes. The default is no.

  • hspace="Zahl"

    Used with the attribute align. Specifies the space in pixels to leave to the media object’s left and right.

  • name="Text"

    Gives the media object a name, particularly useful for accessing it through a script.

  • palette="foreground|background"

    Windows platforms only. The value foreground makes the plugin’s palette the foreground palette. Conversely, the value background makes the plugin use the background palette. This is the default.

  • pluginspage="URL"

    Specifies a URL with installation instructions for the required plugin.

  • units="pixels|en"

    Specifies the measurement unit, pixels or en units, the latter being half the point size of the body text, for the values of height and width. The default is pixels.

  • vspace="Zahl"

    Used with the attribute align. Specifies the space in pixels to leave above and below the object.

Internet Explorer only

  • code="Dateiname"

    If the embedded object is a Java applet, this specifies the class name of the Java code to run.

  • codebase="URL"

    Defines the application’s base URL.

Example with an end tag

<embed src="movies/urlaub.mov" width="240" height="196" pluginspage="http://www.apple.com/quicktime/download/">
<noembed><img src="urlaub.gif">Scheinbar haben Sie nicht das richtige Plugin.</noembed>
</embed>

Example (HTML 5)

<embed src="movies/urlaub.mov" width="240" height="196" type="video/quicktime" />

 

> back to the alphabetical list of elements

   

 

 

 

back to top