HTML <object> Tag
Example
How to use the <object> element to embed a Flash file:
<object width="400" height="400" data="helloworld.swf"></object>
Try it yourself »
Definition and Usage
The <object> tag defines an embedded object within an HTML document. Use this element to embed multimedia (like audio, video, Java applets, ActiveX, PDF, and Flash) in your web pages.
You can also use the <object> tag to embed another webpage into your HTML document.
You can use the <param> tag to pass parameters to plugins that have been embedded with the <object> tag.
Browser Support
Element | ||||||
---|---|---|---|---|---|---|
<object> | Yes | Yes | Yes | Yes | Yes | Yes |
Tips and Notes
Note: An <object> element must appear inside the <body> element. The text between the <object> and </object> is an alternate text, for browsers that do not support this tag.
Tip: For images use the <img> tag instead of the <object> tag.
Tip: At least one of the "data" or "type" attribute MUST be defined.
Differences Between HTML 4.01 and HTML5
Some HTML 4.01 attributes are not supported in HTML5.
The "form" attribute is new in HTML5.
In HTML5, objects can be used and submitted in forms.
In HTML5, objects can no longer appear inside the <head> element of a document.
Attributes
= New in HTML5.
Attribute | Value | Description |
---|---|---|
align | top bottom middle left right |
Not supported in HTML5. Specifies the alignment of the <object> element according to surrounding elements |
archive | URL | Not supported in HTML5. A space separated list of URL's to archives. The archives contains resources relevant to the object |
border | pixels | Not supported in HTML5. Specifies the width of the border around an <object> |
classid | class_ID | Not supported in HTML5. Defines a class ID value as set in the Windows Registry or a URL |
codebase | URL | Not supported in HTML5. Defines where to find the code for the object |
codetype | media_type | Not supported in HTML5. The media type of the code referred to by the classid attribute |
data | URL | Specifies the URL of the resource to be used by the object |
declare | declare | Not supported in HTML5. Defines that the object should only be declared, not created or instantiated until needed |
form | form_id | Specifies one or more forms the object belongs to |
height | pixels | Specifies the height of the object |
hspace | pixels | Not supported in HTML5. Specifies the whitespace on left and right side of an object |
name | name | Specifies a name for the object |
standby | text | Not supported in HTML5. Defines a text to display while the object is loading |
type | media_type | Specifies the media type of data specified in the data attribute |
usemap | #mapname | Specifies the name of a client-side image map to be used with the object |
vspace | pixels | Not supported in HTML5. Specifies the whitespace on top and bottom of an object |
width | pixels | Specifies the width of the object |
Global Attributes
The <object> tag also supports the Global Attributes in HTML.
Event Attributes
The <object> tag also supports the Event Attributes in HTML.
Related Pages
HTML tutorial: HTML Object Element
HTML DOM reference: Object Object
Default CSS Settings
Most browsers will display the <object> element with the following default values:
object:focus {
outline: none;
}