Summary -

In this topic, we described about the <object> tag along with detailed example.

Embedded object or external object in an HTML documents. The <object> tag represents an embedded object in an HTML document. External object can be an image, external resource and plugin etc,.

The tag can be specified like <object type=""></object> or <object data=""></object>. Type and data attributes are mandatory and atleast one of the attribute is needed along with <object> tag.

<object> tag can be used to embed multimedia also in to the HTML document. <object> tag can be used to embed another webpage also in to the HTML document. An <object> element should be coded inside the <body> element.

The text between the <object> and </object> is an fallback text. Objects are no longer appear inside the <head> element of a document in HTML5.

Syntax -

<object>….</object>

Optional Attributes -

AttributeDescriptionValues
alignSpecifies the alignment of object.Not supported in HTML5leftrighttopbottommiddle
ArchiveSpecifies the archive location of objectNot supported in HTML5URL
BorderSpecifies the object border width.Not supported in HTML5Number/pixels
CodebaseSpecifies the object code location.Not supported in HTML5URL
CodetypeSpecifies the object media type.Not supported in HTML5Media_type
dataSpecifies the resource locationURL.
DeclareSpecifies the object should be declared.Not supported in HTML5Declare
formSpecifies the object associated form.HTML5 attributeForm_id
heightSpecifies the object heightNumber/pixels
HspaceSpecifies the space on the left and right side of the object.Not supported in HTML5Number/pixels
nameSpecifies the object nameText
typeSpecifies the type of linked resource to objectMedia_type
usemapSpecifies the image map name.#mapname
widthSpecifies the object widthNumber/pixels.

Example -

<!DOCTYPE html>
<html>
	<head>
		<title>Object tag example..</title>
	</head>
	<body>
		<object width="50" height="50" data="img/footer-logo.png">
		Browser do not support object tag
		</object>
	</body>
</html>	

Output -

Browser do not support object tag