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
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
srccan 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
topandbottomcontrol vertical alignment,leftandrightalign 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
imgelement).hidden="yes|no"Hides playback controls when
hiddenhas the valueyes. The default isno.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
foregroundmakes the plugin’s palette the foreground palette. Conversely, the valuebackgroundmakes 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
bodytext, for the values ofheightandwidth. The default ispixels.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" />
|
Copyright © 2010 O’Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from "HTML & XHTML ─ kurz & gut" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de