HTML <object> Tag
To embed multimedia files (video, audio, image, PDF, Java Applets, or another page) on a web page, the HTML <object> tag is used. To pass the parameters to the plugin included with the <object> tag, the HTML <param> tag is used with the HTML <object> tag. The content within the <object> tag is displayed only when the browser does not support the <object> tag.
Syntax:
<object data="" type=""></object>
Example:
<!DOCTYPE html> <html> <body> <p>Example:</p> <object width="400" height="300" data="img.jpg"> </object> </body> </html>
Explanation:
In the above example, we are embedding an image file using the HTML <object> tag.
Tag specific attributes:
Attribute | Value | Uses | |
align | top
bottom middle left right |
Used to define the alignment of the <object> element relative to the surrounding elements. | This attribute is not supported in HTML5. |
archive | URL | Used to define a space-separated list of URL’s to archives (containing the resources relevant to the object). | This attribute is not supported in HTML5. |
border | pixels | Used to define the width of the border around an <object> element. | This attribute is not supported in HTML5. |
classid | class_ID | Used to specify a class ID value as set in the Windows Registry or a URL. | This attribute is not supported in HTML5. |
codebase | URL | Used to define where to find the code for the object. | This attribute is not supported in HTML5. |
codetype | media_type | Used to define the media type of the code referred to by the class attribute. | This attribute is not supported in HTML5. |
data | URL | Used to define the URL of the resource to be used by the object. | |
declare | declare | Used to specify that the object should only be declared, not created or instantiated until needed. | |
form | form_id | Used to define one or more forms the object belongs to. | |
height | pixels | Used to define the height of the object. | |
hspace | pixels | Used to define the whitespace on the left and right side of an object. | This attribute is not supported in HTML5. |
name | name | Used to define a name for the object. | |
standby | text | Used to specify a text to display while the object is loading. | This attribute is not supported in HTML5. |
type | media_type | Used to define the media type of data specified in the data attribute. | |
usemap | #mapname | Used to define the name of a client-side image map to be used with the object. | |
vspace | pixels | Used to define the whitespace on the top and bottom of an object. | This attribute is not supported in HTML5. |
width | pixels | Used to define the width of an object. |
Global attributes:
The HTML global attributes are supported by the HTML <object> tag.
Event attributes:
The HTML event attributes are supported by the HTML <object> tag.
Supporting Browsers:
Chrome, IE, Firefox, Opera, and Safari.