If you find this helpful, please click the Google Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.) |
The <embed/> Tag in HTML 5
The <embed> tag can be used to embed content from an external resource into a web page.
Using an <object> to embed a YouTube video
<embed/> Tag Syntax
Rules for coding HTML embed/
elements
<embed .../>
<embed/> Content Model
Contents of the embed element
Content: Empty. All properties are coded using attributes.
Since the <embed/>
tag is a void element, it is not allowed to have any content, even HTML comments and therefore should always be coded as a self-closing standalone tag, ending with the delimiter string />
rather than just >
(<embed .../>
).
<embed/> Tag Attributes
Attributes of the <embed/> tag
global attributes | In addition to the personal attributes of the <embed/> tag below, any of the common HTML attributes can also be coded. |
src | a URI reference that resolves to the URL of the embedded resource Use percent escape codes as explained in the URL Encoding Tutorial for any special characters in the URI reference. If the value of the
If the protocol scheme, username, host name/IP address and port number are omitted the default is the current host - the same server as the base of the current document. If the path starts with a slash |
type | |
width, height |
<embed/> Tag Examples
Examples of the <embed/> tag in HTML 5
Example of embedding video in HTML 5
The "old" YouTube embed code used an <object> tag and an <embed> tag. The <embed> tag provides a fallback for browsers that do not support the <object> tag. (The "new" YouTube code uses the <iframe> tag.
<object width="640" height="390"> <param name="movie" value="http://www.YouTube.com/v/GGT8ZCTBoBA?fs=1&hl=en_US"/> <param name="allowFullScreen" value="true"/> <param name="allowscriptaccess" value="always"/> <embed src="http://www.YouTube.com/v/GGT8ZCTBoBA?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="390"/> </object>
Since the <param/>
tag is a void element, it is not allowed to have any content, even HTML comments and therefore should always be coded as a self-closing standalone tag, ending with the delimiter string />
rather than just >
(<param .../>
).
Changes in HTML 5 - <embed/> Tag
What's new in HTML 5
Differences between HTML 5 and earlier versions of HTML
The <embed/> tag did not exist in older versions of HTML.
In ployglot HTML documents the <embed/>
tag is coded as a self-closing tag the same as in the 2000-2010 Recommendations from the W3C HTML Working Group. Those specifications changed the ending delimiter to />
from >
in older recommendations. They also defined the HTML namespace for the embed element type name and the names of other HTML element types.