HTML and CSS Reference
In-Depth Information
The embed element
While the img element added richness to web pages, at the time it was introduced, it
was apparent that support for only still images was not enough. The Web needed a way
to handle a variety of embedded media. During the 1993 discussions about introducing
the img element, another element was proposed by Tim Berners-Lee (widely credited
as the inventor of the World Wide Web). He suggested adding an embed element in
place of img that would address the latter's shortcomings, namely, that it only supported
embedding images and not other media or data. Eventually both elements were imple-
mented by web browser makers, img for images and embed for other media (video for
instance), but an officially backed solution to support richer media would fragment in
several directions for years to come.
embed was first implemented by Netscape, and while other browsers implemented it
as well, it had quirks that prevented it from being standardized. Specifically, it can in-
clude arbitrary attributes (not just attribute values, but the attributes themselves), which
can differ depending on the media being embedded. These additional attributes could
be anything, because they will be passed as parameters to the plug-in used to handle
the content, which may respond to them. This was a behavior that didn't rest easy with
the W3C, particularly when the stricter syntax requirements of XHTML appeared to be
the future direction of HTML. By the time the HTML 4.01 specification came about
in 1999, embed was considered obsolete and was discouraged from being used. That
could have been the end of the story for the embed element, but HTML5 has brought it
back by officially standardizing it as part of the HTML specification, albeit in a stripped-
down form. HTML5 aims to be backward-compatible and document what is in useā€”and
despite its quirks, embed is still used today.
In addition to the global attributes, embed in HTML5 has a simple set of four attrib-
utes as opposed to fifteen, the number that previous implementations had attached to it.
The four attributes are width , height , src , and type .
The width and height attributes specify the dimensions in pixels that the embed-
ded media will occupy on the page, while the src attribute specifies the address of the
source media file to embed. As stated earlier, additional attributes may be added to com-
municate settings to the plug-in set to handle a particular type of media. For instance,
the following code snippet includes a loop attribute, which is passed on to Adobe Flash
Player (the plug-in that will handle SWF content):
<embed src="game.swf" loop="true" />
Search WWH ::




Custom Search