HTML <object> Attributes

HTML <object> align Attribute

A right-aligned <object>:

<object width=”200″ height=”200″ data=”helloworld.swf” align=”right”></object>

Try it Yourself »


Definition and Usage

The align attribute specifies the alignment of an <object> element according to the surrounding element.

The <object> element is an inline element (it does not insert a new line on a page), meaning that text and other elements can wrap around it. Therefore, it can be useful to specify the alignment of the <object> according to surrounding elements.

HTML <object> border Attribute

An <object> with a 5 pixels thick border:

<object width=”200″ height=”200″ data=”helloworld.swf” border=”5″></object>

Try it Yourself »


Definition and Usage

The border attribute specifies the width of the border around an <object>.

HTML <object> data Attribute

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 data attribute specifies the URL of the resource to be used by the object.

HTML <object> form Attribute

An <object> element located outside a form (but still a part of the form):

<form action=”/action_page.php” id=”form1″>
First name: <input type=”text” name=”fname”><br>
<input type=”submit” value=”Submit”>
</form><object data=”helloworld.swf” height=”400″ width=”400″ form=”form1″ name=”obj1″></object>

Try it Yourself »


Definition and Usage

The form attribute specifies one or more forms the <object> element belongs to.

HTML <object> height Attribute

A flash animation with a height and width of 400 pixels::

<object data=”helloworld.swf” height=”400″ width=”400″></object>

Try it Yourself »


Definition and Usage

The height attribute specifies the height of the object, in pixels.

HTML <object> hspace Attribute

An object with a 100 pixels margin on both left and right sides:

<p><object width=”150″ height=”150″ data=”helloworld.swf” hspace=”100″></object>
This is some text. This is some text. This is some text.</p>

Try it Yourself »


Definition and Usage

The hspace attribute specifies the whitespace on left and right side of an object.

HTML <object> name Attribute

An <object> element with a name attribute:

<object data=”helloworld.swf” width=”400″ height=”400″ name=”obj1″></object>

Try it Yourself »


Definition and Usage

The name attribute specifies the name of an <object> element.

The name attribute is used for referencing an <object> element in JavaScript (an alternative, is to reference it by using its id attribute).

HTML <object> type Attribute

An <object> element with a specified media type:

<object width=”400″ height=”400″ data=”helloworld.swf”type=”application/vnd.adobe.flash-movie”></object>

Try it Yourself »


Definition and Usage

The type attribute specifies the Internet media type (formerly known as MIME type) of the object.

HTML <object> usemap Attribute

An <object> element using an image map:

<object data=”planets.gif” width=”145″ height=”126″ usemap=”#planetmap”></object>

Try it Yourself »


Definition and Usage

The usemap attribute specifies the name of an image-map to use with the object.

An image-map is an image with clickable areas.

The usemap attribute is associated with a <map> element’s name attribute, and creates a relationship between the object and the map.

HTML <object> vspace Attribute

An object with a 100 pixels margin on top and bottom:

<p><object width=”150″ height=”150″ data=”helloworld.swf” vspace=”100″></object>
This is some text. This is some text. This is some text.</p>

Try it Yourself »


Definition and Usage

The vspace attribute specifies the whitespace on top and bottom of an object.

HTML <object> width Attribute

A flash animation with a height and width of 400 pixels::

<object data=”helloworld.swf” width=”400″ height=”400″></object>

Try it Yourself »


Definition and Usage

The width attribute specifies the width of the object, in pixels.