HTML and CSS Reference
In-Depth Information
Optional Attributes
value : The value of the parameter.
embed
As the HTML5 spec states, the embed element is “an integration point for an external (typically non-HTML)
application or interactive content.” In simpler terms, this element embeds content that requires a plug-in.
It's similar to the object element in that regard, but unlike object , embed is a void element that can't hold
any contents, meaning you can't readily provide any fallback content within the element. If the browser
lacks the requisite plug-in to process the embedded resource, the embed element won't do anything at all.
Listing 5-9 shows an example of the embed element, here embedding an MP4 video file. Some browsers
can play MP4 video natively, but only in a video element. If you embed the file directly with an embed
element (or object ), the browser will attempt to invoke the appropriate plug-in (such as QuickTime) to
handle the media.
Listing 5-9. An MP4 video clip embedded in a document with the embed element
<embed src="video/feature.mp4" type="video/mp4" width="394" height="298">
The video element is a far better way to embed videos in your web pages. However, you can use embed
within a video (or audio ) element to include the fallback for older browsers—either embedding a Flash-
based media player or embedding the media directly—the same way you would use the object element:
<video controls width="468" height="350">
<source src="video/mechanical-monsters.mp4" type="video/mp4">
<source src="video/mechanical-monsters.webm" type="video/webm">
<embed src="flash/video-player.swf" flashvars="video/mechanical-monsters.mp4"
type="application/x-shockwave-flash" width="468" height="350">
</video>
The embed element is newly standardized in HTML5, though it's actually been around for a long time as a
non-standard and invalid element. Not so long ago, embed enjoyed better cross-browser support than
object , even though embed wasn't part of any standardized HTML specification—it was introduced by
Netscape years ago and other browsers imitated Netscape's implementation.
The object element is fully supported in current browsers, but because so many websites used the non-
standard embed element for so long, embed became a de facto standard simply through common usage.
HTML5 has followed the “pave the cow paths” methodology: observe what people are using in the real
world, then tidy it up and make it official. The embed element is now valid in HTML5, but object is still
preferable.
Required Attributes
The embed element doesn't require any attributes, though a src attribute is usually required to provide the
resource's address. An embed element with no attributes is technically valid, but represents nothing.
 
Search WWH ::




Custom Search