HTML5 <object> Tag

The HTML <object> tag is used to represent an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin.

The only content permitted inside this element is zero or more <param> elements optionally followed by transparent content. Both the starting and ending tag are mandatory for this element. The parent of the <object> tag can be any element that accepts embedded content.

The following style is applied to this element by default:

object:focus {
  outline: none;
}

Here is an example of using this tag:

<object data="movie.swf" type="application/x-shockwave-flash"></object>

<!-- Embedding an HTML page -->
<figure>
  <object data="clock.html"></object>
  <figcaption>My HTML Clock</figcaption>
</figure>

Attributes

data

The address of the resource as a valid URL. At least one of data and type must be defined.

form (HTML5)

The form element, if any, that the object element is associated with (its form owner). The value of the attribute must be an ID of a <form> element in the same document.

height

The height of the displayed resource, in CSS pixels.

name

The name of valid browsing context (HTML5), or the name of the control (HTML 4).

type

The content type of the resource specified by data. At least one of data and type must be defined.

typemustmatch HTML5

This Boolean attribute indicates if the type and the actual content type resource must match in order of this one to be used.

usemap

A hash-name reference to a <map> element; that is a ‘#’ followed by the value of a name of a map element.

width

The width of the display resource, in CSS pixels.

Further Reading

  1. Read more about the HTML <object> element on MDN.
  2. You can also read the HTML <object> tag reference on W3C.

Reader Comments

1. You can register or login to post a comment. Asking readers to register improves the quality of discussion.

2. As a registered user, you will also get to access features like choosing between a light and dark theme or anything else that we might implement in future.

Follow Us For Updates

FacebookTwitterGoogle+
Go To Top