Media & Embedded Content

HTML <object> Tag

The <object> tag defines a container for an external resource.

Definition and Usage

The <object> tag defines a container for an external resource.

Standard Syntax:<object>...</object>

Interactive ExampleRunnable

HTML <object> Example

html
Try it Yourself
Live code demonstration for the <object> tag. Click "Try it Yourself" to edit and experiment in real time.
<div style="font-family: system-ui, sans-serif; padding: 16px; background: #ffffff; border-radius: 8px; border: 1px solid #e2e8f0; color: #0f172a;">
<object data="pic_trulli.jpg" width="300" height="200"></object>
</div>

Attributes for <object>

8 Supported Attributes
AttributeValuesDefaultDescription
dataURLnoneSpecifies the URL of the resource to be used by the object
formform_idnoneSpecifies which form the object belongs to
heightpixelsnoneSpecifies the height of the object
namenamenoneSpecifies a name for the object
typemedia_typenoneSpecifies the media type of data specified in the data attribute
typemustmatchtrue/falsenoneSpecifies whether the type attribute and the actual content of the resource must match to be displayed
usemap#mapnamenoneSpecifies the name of a client-side image map to be used with the object
widthpixelsnoneSpecifies the width of the object
Global Attributes

The <object> tag also supports the standard global attributes in HTML, including class, id, style, title, hidden, and data-*.

HTML Global Attributes Reference →
Event Attributes

The <object> tag supports event attributes in HTML, such as onclick, onmouseover, onfocus, and more.

HTML Event Attributes Reference →

Browser Compatibility

ChromeEdgeFirefoxSafariOpera

More Tags in Media & Embedded Content

View All 123Tags →