<object>

HTML <object> Tag

The <object> tag specifies an embedded object within an HTML document. It is generally used for embedding multimedia (audio, video, Java applets, Flash applications, etc.) or another HTML document into the web page.

You can include alternative text in the <object> tag that will be shown if browsers don’t support this tag.

You can use the <param> tag to pass parameters to plugins that have been embedded using the <object> tag.

For images, the <img> tag can be used instead of the <object> tag. You should define at least one of the type or data attributes.

Syntax

Syntax

The <object> tag comes in pairs. The content is written between opening (<object>) and closing (</object>) tags. The <object> tag is used as a child element of <body>.

Example of the HTML <object> tag:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the webpage</title>
  </head>
  <body>
    <p>Steve Jobs' Stanford Commencement Address - YouTube</p>
    <object width="320" height="240" data="https://www.youtube.com/embed/bZNEB_o3Hzw?ecver=2">
    </object>
  </body>
</html>

Attributes

Attributes

AttributeValueDescription
aligntopbottommiddleleftrightSpecifies the alignment of the content inside <object> element according to surrounding elements.
Not supported in HTML 5.
archiveURLDefines a list of URLs to archives containing resources relevant to the object. Not supported in HTML5.
borderpixelsSets the width of the border around an <object>. Not supported in HTML5.
classidURLSets the URL of the object’s implementation. It can be used together with, or instead of, the data attribute.
Not supported in HTML5.
codebaseURLDefines the path used to resolve relative URIs specified by classid, data, or archive. If not specified, the default is the base URI of the current document.
Not supported in HTML5.
codetypemedia_typeSets media type of the code referred to by the classid attribute.
Not supported in HTML5.
dataURLSets the URL of the resource that will be used by the object.
declaredeclareSpecifies that the object should only be declared. Not supported in HTML5.
formform_idSpecifies one or more forms <object> belongs to.
heightpixelsSpecifies the height of the object.
hspacepixelsSpecifies the whitespace on the left and right sides of an object.
Not supported in HTML5.
namenameSpecifies a name for the object.
standbytextSpecifies a text to be displayed while the object is loading.
Not supported in HTML5.
tabindexnumberSets the position of an element in the tabbing navigation order for the current document.
typemedia_typeSpecifies the media type of data specified in the data attribute.
usemap#mapnameSpecifies the name of a client-side image map to be used with the object (a hash-name reference to the <map> element).
vspacepixelsSets the whitespace on top and bottom of an object.
Not supported in HTML5.
widthpixelsSet the width of an object.

The <object> tag also supports the Global attributes and the Event Attributes.



请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部