HTML <object>
Tag
Topic: HTML5 Tags ReferencePrev|Next
Description
The <object>
tag defines an embedded object within an HTML document. It is used to include a variety of different kinds of media files into a document such as videos, audio, Java applets, ActiveX, PDF document, Flash animations or even images. You can also use the <object>
element to embed another webpage into your HTML document.
Note: The <param>
element is used to pass parameters to the plugins that have been embedded with the <object>
element.
The following table summarizes the usages context and the version history of this tag.
Placement: | Block |
---|---|
Content: | Block, inline, and text; any <param> elements must come first |
Start/End Tag: | Start tag: required, End tag: required |
Version: | HTML 4, 4.01, 5 |
Syntax
The basic syntax of the <object>
tag is given with:
The example below shows the <object>
tag in action.
Example
Try this code »<object type="application/x-shockwave-flash">
<param name="movie" value="video/blur.swf">
</object>
Tip: It is recommended to use the type
when data
is specified since it allows the browser to avoid loading information for unsupported content types.
Tag-Specific Attributes
The following table shows the attributes that are specific to the <object>
tag.
Attribute | Value | Description |
---|---|---|
Required — One of the following attributes must be specified for the markup to be valid. | ||
data |
URL | Specifies the location of the data or file that the object requires. |
type |
content-type | Specifies the content-type of the resource specified by data attribute. At least one of data and type must be defined. |
Optional — The following attributes are optional. | ||
align |
left |
Obsolete Use CSS instead. Specifies the alignment of <object> element with respect to the surrounding content. |
archive |
URLs | Obsolete A space separated list of URL's to archives containing resources relevant to the object. |
border |
pixels | Obsolete Specifies the width of the border around the object. Use the CSS border property instead. |
classid |
URI | Obsolete Defines the URL or internal reference for the object's implementation. |
codebase |
URI | Obsolete Specifies the base path used to resolve relative URL's specified by the classid , data , and archive attributes. |
codetype |
content-type | Obsolete Specifies the content-type of data expected when downloading the object specified by classid attribute. |
declare |
declare |
This boolean attribute specifies that the object should only be declared but not instantiated. |
form |
form-id | Specifies the form that the object element is associated with i.e. its "form owner". |
height |
length | Sets the object's height. |
hspace |
pixels | Obsolete Specifies the amount of whitespace on left and right side of an object. |
name |
text | Specifies the name of the object. |
standby |
message | Obsolete Specifies a text message to be displayed while the object is loading. |
usemap |
URL | Defines a client-side image map associated with an image object element. |
vspace |
pixels | Obsolete Specifies the amount of whitespace on top and bottom side of an object. |
width |
length | Sets the object's width. |
Global Attributes
Like all other HTML tags, the <object>
tag supports the global attributes in HTML5.
Event Attributes
The <object>
tag also supports the event attributes in HTML5.
Browser Compatibility
The <object>
tag is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: HTML Audio, HTML Video.
Related tag: <param>
.