Skip to main content

HTML Object and Embed Elements

By SamK
0
0 recommends
Topic(s)

In this tutorial, you'll learn about the HTML object and embed elements.

The <object> Element

The <object> element is compatible with all browsers.

This element is used to define an embedded object within an HTML document.

Initially, it was designed to embed plug-ins (such as Java applets, PDF readers, and Flash Players) in web pages, but it can also be used to include HTML content within an HTML document.

<object width="400px" height="400px" data="code.html"></object>

For an image:

<object data="image.png"></object>

The <embed> Element

The <embed> element is supported by all major browsers.

It defines an embedded object within an HTML document.

Although web browsers have long supported the <embed> element, it was not officially included in the HTML specification until HTML5.

<embed src="image.png">

Note: The <embed> element is a void element in HTML, meaning it does not have a closing tag and cannot contain any content or alternative text. 

The <embed> element can also be used to embed HTML within an HTML document:

<embed width="400px" height="400px" src="code.html">

Please check below options for the links to our previous or next tutorial.

Questions & Answers