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 -
Attribute | Description | Values |
---|---|---|
align | Specifies the alignment of object.Not supported in HTML5 | leftrighttopbottommiddle |
Archive | Specifies the archive location of objectNot supported in HTML5 | URL |
Border | Specifies the object border width.Not supported in HTML5 | Number/pixels |
Codebase | Specifies the object code location.Not supported in HTML5 | URL |
Codetype | Specifies the object media type.Not supported in HTML5 | Media_type |
data | Specifies the resource location | URL. |
Declare | Specifies the object should be declared.Not supported in HTML5 | Declare |
form | Specifies the object associated form.HTML5 attribute | Form_id |
height | Specifies the object height | Number/pixels |
Hspace | Specifies the space on the left and right side of the object.Not supported in HTML5 | Number/pixels |
name | Specifies the object name | Text |
type | Specifies the type of linked resource to object | Media_type |
usemap | Specifies the image map name. | #mapname |
width | Specifies the object width | Number/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>