Note: If you don't know what an element/tag is and/or how you must use it we recommend you to read our HTML tags and attributes tutorial that you can find in our HTML tutorials section.
Table of contents
Bypass table of contentsThe HTML object element is used to run external aplications like applets, flash movies or images.
This element becomes useful when showing content that's not natively supported by the browser, by allowing authors to specify which application should intervene in order to show properly the custom content.
Since the beginning, this element has been very poorly supported by browsers, and even nowadays, only some instances are compatible. This is the case of flash movies, that need to be defined using the attributes "data" and "type" (instead of "classid") to work in browsers like Netscape and Mozilla.
Some attributes for this element have a strong presentational nature, for which they have been deprecated in HTML 4.01 in favor of style sheets. These attributes are: "align", "border", "hspace" and "vspace".
In the next example, the HTML object element is used to show an image.
Next, a flash movie is inserted using the HTML object element. Note that the declaration uses the "data" and "type" attributes instead of the typical "classid". This is because movies inserted using the "classid" attribute aren't displayed in some browsers like Mozilla and Netscape. In fact, the following, is the most compatible "valid" declaration until now. The only problem with it is that in Internet Explorer, the movie is fully loaded before starting, which could be a problem for long movies.
The "id" attribute assigns an identifier to the associated element. This identifier must be unique in the document and can be used to refer to that element in other instances (e.g., from client-side scripts).
The "class" attribute assigns a class name (or a list of class names separated by spaces) to the container element. It's used together with style sheets and tells the browser the class (or classes) to which the element is associated with.
A class gives presentational attributes to elements (read more at the Cascading Style Sheets tutorial).
This attribute is used to define presentational attributes for the containing element, and its value should be composed by style sheets properties. Although, in some cases, it can become useful, a better practice is to place presentational attributes in external files, relating them to elements with the "class" attribute. This way you keep the semantic and presentational parts of your document separated.
You can find more information about presentational attributes at the Cascading Style Sheets tutorial.
The purpose of this attribute is to provide a title for the element. Its value must be a short and accurate description of the element. Browsers usually render it as a "tool tip" when the user puts the mouse pointer over the element for a small period of time.
Specifies the language of an element's content. The default value in "unknown".
When writing XHTML 1.0 documents, the attribute used to specify the language of an elements is "xml:lang". For forward and backward compatibility both attributes can be used simultaneously like in the example below. Note, that in XHTML 1.1 the "lang" attribute has been completely replaced by "xml:lang" and its use is no longer valid.
This attribute indicates the direction in which the texts of the element must be read. This includes content, attribute values and tables. It has two possible values that are case-insensitive:
This attribute assigns a name to the element, that can be used to refer to it in scripts or style sheets.
The value of this attribute points to an image map (HTML map element) that will be associated to this element. Therefore, this value must match the value of the "name" attribute in the image map.
Specifies the position of this element in the tabbing order. The tabbing order defines a sequence with all the elements than can receive the focus. Users can navigate this sequence via keyboard (usually with the "tab" key).
Specifies the width of the image. This can be different to the real width of the image, and browsers should resize it as needed. However, specifiyng a different width may cause a pixelated images (when bigger) or longer load periods (when smaller).
Specifies the height of the image. This can be different to the real height of the image, and browsers should resize it as needed. However, specifiyng a different height may cause a pixelated images (when bigger) or longer load periods (when smaller).
This attribute points to the location of an object's implementation. May be replaced or used with the "data" attribute, depending on the object's type.
Sets the base URI used as starting point to resolve relative URIs in the "classid", "data" and "archive" attributes. The default value is the base URI of the document.
Specifies the content type of the object declared in the "classid" attribute. When absent, it takes the value of the "type" attribute.
Specifies the location of the object's data.
Specifies the content type of the data declared in the "data" attribute.
Provides a space-separated list of resources useful for the object, that may include the resources declared in the "classid" and "data" attributes. It can be used to preload resources, reducing the loading time.
The presence of this boolean attribute means that the current object is meant to work as a declaration only. To be used, the object must be instantiated by another object referring to it.
Remember that in XHTML, boolean attributes must take their own names as value (e.g., attr_name="attr_name").
Provides a text to be shown while the object is loading.
This attribute has been deprecated in HTML 4.01. Therefore its use is no longer recommended.
This attribute specifies the position of the image with respect to the surrounding content. It can take the following case-insentive values:
This attribute has been deprecated in HTML 4.01. Therefore its use is no longer recommended.
This attribute sets the border width in number of pixels.
This attribute has been deprecated in HTML 4.01. Therefore its use is no longer recommended.
Sets the amount of white space (in pixels) to be inserted at the left and right margins of the image.
This attribute has been deprecated in HTML 4.01. Therefore its use is no longer recommended.
Sets the amount of white space (in pixels) to be inserted at the top and bottom margins of the image.
See a complete list and information about events in HTML
Diseño y desarrollo: Latitud29.com