HTML5 Embed Tag

The Html <embed> element is used to embedding an external application or interactive content to the web page. This is a standard and well supported HTML5 tag for embedding multimedia files into the web page (note that prior to the HTML5 specification, this tag is used as the non-standard tag and supported by all the browsers. HTML5 has added to the specification.

One of the important point is that, <embed> tag will not support any of the natively supported by the browsers like HTML and Images. The purpose of this tag is to add the objects which are not supported by the browsers and requires plug-in to display like flash player.

Syntax of <embed> Tag

<embed src=" media file name"> </embed>

Browser Support

<embed> element in HTML5 is supported in almost all browsers such as Internet Explorer, Firefox, Opera, Chrome, and Safari.

Attributes of <embed> Tag

  • src : This attribute specifies the url address of the external file.
  • height : This attribute specifies the content height that to be displayed.
  • width : This attribute specifies the content width that to be displayed.
  • type : This attribute specifies MIME type of the content embedded.

HTML5 <embed> Example

<!DOCTYPE HTML>
<html>
 <head>
   <title>HTML5 embed element example</title>
 </head>
 <body>
   <embed src="embed_element.gif" width="40%" height="250" >
 </body>
</html>
  • <embed src=”embed_element.gif” width=”100%” height=”250″ > is used to insert the image by using the attribute src which specify the location of the image, width and height attribute is used to set the height of the image.

Example Application Test

  • Save the file as embed.html in your system.
  • Just open the file in the browser, you will see the below picture in the browser. Note that the browser must support HTML5 specification.

Output

When the execution process is completed successfully we will get the following output :
html5 embed

Comments

comments

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Speak Your Mind

*