HTML: Object Tag

By Xah Lee. Date: .

HTML object Tag tutorial

what is HTML object Tag

ai answer

The HTML <object> tag (or <object> element) embeds an external resource into an HTML document. The resource can be treated as an image, a nested browsing context (e.g., another webpage), or content handled by a plugin.

Key points

Common attributes

Attribute Description
data URL of the resource to embed
type MIME type of the resource (e.g., application/pdf, video/mp4)
width / height Dimensions of the embedded content (in CSS pixels)
name Name of the object (useful for scripting or forms)
form Associates the object with a form (HTML5)
usemap Links to a client-side image map

Many older attributes (archive, classid, codebase, codetype, declare, border, etc.) are deprecated or obsolete in modern HTML.

Basic example

<object data="example.pdf" type="application/pdf" width="600" height="400">
  <p>Your browser does not support PDFs.
     <a href="example.pdf">Download the PDF</a> instead.
  </p>
</object>

Another example (embedding a video with fallback image)

<object type="video/webm" data="flower.webm" width="600" height="140">
  <img src="flowers.jpg" alt="Some beautiful flowers" />
</object>

Notes