HTML5 <object> Tag

Example

How to use the object element to display Flash:

<object data="helloworld.swf"></object>

Try it yourself »

Definition and Usage

The <object> tag is used to include objects such as images, audio, videos, Java applets, ActiveX, PDF, and Flash.

The object element allows you to specify the data and parameters for objects inserted into HTML documents, and the code that can be used to display/manipulate that data.


Differences Between HTML 4.01 and HTML5

Some HTML 4.01 attributes are not supported in HTML5.

The "form" attribute is new in HTML5.

Objects can be used and submitted in forms.

Objects can no longer appear inside the <head> tag of a document.


Tips and Notes

Note: An object element can appear inside the body element. The text between the <object> and </object> is the alternate text, for browsers that do not support this tag. The <param> tags define run-time settings for the object.

Tip: For images use the <img> tag instead of the <object> tag.

Tip: At least one of the "data" and "type" attributes MUST be defined.


Attributes

New : New in HTML5.

Attribute Value Description
align left
right
top
bottom
Not supported in HTML5.
archive URL Not supported in HTML5.
border pixels Not supported in HTML5.
classid class_ID Not supported in HTML5.
codebase URL Not supported in HTML5.
codetype MIME_type Not supported in HTML5.
data URL Defines a URL that refers to the object's data
declare declare Not supported in HTML5.
formNew formname Defines one ore more forms the object belongs to.
height pixels Defines the height of the object
hspace pixels Not supported in HTML5.
name unique_name Defines a unique name for the object (to use when a form is submitted).
standby text Not supported in HTML5.
type MIME_type Defines the MIME type of data specified in the data attribute
usemap URL Specifies the name of a client-side image map to be used with the object
vspace pixels Not supported in HTML5.
width pixels Defines the width of the object

Standard Attributes

The <object> tag also supports the Standard Attributes in HTML5.


Event Attributes

The <object> tag also supports the Event Attributes in HTML5.