embed element provides the means to insert external applications, typically those that require a plugin, into the document.
This element, introduced by Netscape 2 and then adopted by Internet Explorer 3 (back in the early '90s), has never before been part of an HTML standard. Nevertheless, it's been very well supported by all browsers in the market and frequently used in multiple websites, primarily, to insert Flash movies. Being so well supported, thanks basically to its longevity, the
embed element has been the first choice for authors when they needed to embed Flash movies in their documents, despite the fact that it's been non-conformant all the time. This, added to the buggy and irregular implementations of the
object element, has led HTML5 to bring it into the specification.
The most popular use for the
embed element is to run flash movies inside a document. This example is reproducing exactly that situation. Beside the four standard attributes (
height), we're providing two more (
wmode) that will be passed to the plugin as parameters, in order to command it to use high quality and transparent background in the movie.
<p>I can hardly see anything. Could you please turn on the light?</p> <embed src="/assets/flash/light-bulb.swf" type="application/x-shockwave-flash" width="180" height="350" quality="high" wmode="transparent">
I can hardly see anything. Could you please turn on the light?
In the second example, we're going to insert a MIDI file. This is another typical type of resource that depends on a plugin. Remember that if you don't have the plugin installed in your browser you won't be able to access the resources inserted with
height attributes have been ommited (as they are not needed) in order to let the plugin decide the appropriate dimension needed to display the controls. Additionally, a custom attribute has been set (
autostart) to tell the plugin that it shouldn't start playing the file automatically.
<p>Here you have the MIDI version of "Air on the G string".</p> <embed src="/assets/audio/Bach_Air_on_the_G_string.mid" type="audio/mid" autostart="false">
Here you have the MIDI version of "Air on the G string".
The URI of the resource that is to be embedded by this element and executed by the plugin.
This attribute is mandatory if the
itemprop attribute is present in the
embed element, as it's used to determine the value of the property.
The content type (or Internet media type) of the resource specified in the
If both attributes,
type are declared, the latter must match the content-type metadata provided by the resource in
<embed src="suite-in-g-minor.mid" type="audio/mid"></embed>
A number of pixels indicating the width of the element. If this attribute is omitted a default value will be used.
<embed src="commercial.swf" height="640" height="480"></embed>
A number of pixels indicating the height of the element. If this attribute is omitted a default value will be used.
<embed src="menu.swf" height="150"></embed>
For information about global attributes refer to this list of global attributes in HTML5.
For information about global events refer to this list of global events in HTML5.