html tutorial - <object> Tag in HTML - html5 - html code - html form



object tag in html

Learn html - html tutorial - object tag in html - html examples - html programs

  • The <object> tag specifies an embedded object within a document.
  • The <object> tag is used to insert multimedia like, audio, video, Java applets, ActiveX, PDF, and Flash in the web pages.
  • The <object> tag also used to insert different webpage into HTML document.
  • The <param> tag is used to pass parameters to plugins which have been inserted with the <object> tag.
  • The <object> tag belongs to flow content, phrasing content, embedded content and palpable content.
  • The <object> tag supports Global Attributes and Event Attributes.

Syntax for <object> tag:

<object data = “URL”>content</object>

Differences between HTML 4.01 and HTML 5 for <object> tag in HTML:

HTML 4.0.1

  • HTML 4 is does not support “form” attributes.

HTML 5

  • HTML 5 is support “form” attributes.
  • HTML 5 does not support some attributes such as align, archive, border, classtype, etc. Which are supported in HTML 4.
  • The objects can no longer occur inside the <head> tag of a document.

Sample Coding for <object> tag:

Tryit<!DOCTYPE html>
<html>
    <head>
        <title>Wikitechy object tag</title>
    </head>
    <body>
        <h2>HTML object tag with example </h2>
        <object width="300" height="300" data="hibiscus.mp4">
        </object>
    </body>
</html>

Code Explanation for <object> tag:

<object> Tag Code Explanation

  1. <object> tag is used to embed an object video within a document.
  2. data is an attribute, which indicates the URL of the video file.

Output for <object> tag:

<object> Tag Output

  1. The output shows the video file.

Attributes of <object> tag:

Attribute Value HTML4 HTML5 Description
align top
bottom
middle
left
right
Yes No Defines the alignment of the <object> tag according to nearby elements.
archive URL Yes No A space divided the list of URL's to archives. The archives have a resource related to the object.
border Pixel Yes No Indicates the width of the border around an <object>
classid class_ID Yes No Specifies a class ID value as set in the Windows Registry or a URL.
codebase URL Yes No Describes where to discover the code for the object.
codetype media_type Yes No The media type of the code indicated by the class id attribute.
data URL Yes Yes Defines the URL of the resource.
declare declare Yes No Specifies which the object should only be indicated, till needed.
form form_id No Yes The object belongs to one or more forms.
height pixels Yes Yes Indicates the object’s height.
hspace pixels Yes No Defines the whitespace on left and right side of an object.
name name Yes Yes Describes a name for the object.
standby text Yes No Specifies a text to show while the object is loading.
type media_type Yes Yes Defines the media type of data specified in the data attribute.
usemap #mapname Yes Yes Defines the name of a client-side image map to be used with the object.
vspace pixels Yes No Set the whitespace on top and bottom of an object.
width pixels Yes Yes Set the width of the object.

Browser Support for <object> tag in HTML:

Yes Yes Yes Yes Yes

Tips and Notes

  • An <object> tag should be declared inside the <body> tag.
  • For images using the <img> tag instead of the <object> tag.
  • The "data" or "type" attribute must be described.

Related Searches to <object> tag in html