HTML Tag Reference - HTML tag <object>








This <object> element embeds object in the page. It provides an effective way to deal with new media. This element gives you control over the data and code in the created object.

The text between the element's opening and closing tags is displayed in the event that the object cannot be loaded.

Browser compatibility

<object> Yes Yes Yes Yes Yes




What's new in HTML5

Some HTML 4.01 attributes are deprecated in HTML5.

The "form" attribute is new in HTML5.

Attribute

Attribute Value Description
align top
bottom
middle
left
right
Not supported in HTML5.
Set the alignment of the <object> element
archive URL Not supported in HTML5.
A space separated list of URL's to archives which 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.
Create a ID value as set in the Windows Registry or a URL
codebase URL Not supported in HTML5.
Set where to find the code for the object
codetype media_type Not supported in HTML5.
Set media type for the code referred to by the classid
data URL Set the URL of the resource to be used by the object
declare declare Not supported in HTML5.
Set that the object should be declared, not created until needed
form form_id Set one or more owner forms
height pixels Set the height of the object
hspace pixels Not supported in HTML5.
Set the whitespace on left and right side
name name Set a name for the object
standby text Not supported in HTML5.
Set text to display while loading the object
type media_type Specifies the media type of data specified in the data attribute
usemap #mapname Set the name of a client-side image map to be used with the object
vspace pixels Not supported in HTML5.
Set the whitespace on top and bottom of an object
width pixels Set the width of the object




Global Attributes

The <object> tag supports the Global Attributes in HTML.

Event Attributes

The <object> tag supports the Event Attributes in HTML.

Default CSS Settings

object:focus {
    outline: none;
}

Example

A demo showing how to use <object> tag.

<html>
<body>
     <object data="http://java2s.com/style/download.png" shapes>
          <a target="main" 
             shape="rect" 
             coords="0, 0, 100, 50" 
             href="http://www.w3c.com"></a> 
          <a target="main" 
             shape="rect" 
             coords="100, 0, 200, 50" 
             href="http:// www.microsoft.com"></a> 
          <a target="main" 
             shape="rect" 
             coords="0, 50, 100, 100" 
             href="http://www.msn.com"></a> 
          <a target="main" 
             shape="rect" 
             coords="100, 50, 200, 100" 
             href="http://www.yahoo.com"></a>
     </object>
     <br/>
</body><!--from  w ww  .jav a2 s  .  c  o  m-->
</html>

Click to view the demo