HTML <object>
Tag
The HTML <object>
tag is used to embed external resources such as images, videos, or interactive content into an HTML document. It allows you to include objects from external sources directly within your webpage. This can be useful for displaying media content, interactive applications, or other types of resources.
Example:
<object data="example.jpg" type="image/jpeg">
Your browser does not support the object tag.
</object>
In the above example, an image file example.jpg
is embedded into the HTML document using the <object>
tag. The data
attribute specifies the URL of the external resource, and the type
attribute defines the type of the object (in this case, an image file of type JPEG).
Main Attributes of the <object>
Tag:
Attribute | Description |
---|---|
data |
Specifies the URL of the external resource to be embedded. |
type |
Specifies the MIME type of the resource being embedded. |
width |
Sets the width of the embedded object in pixels or as a percentage of the parent container. |
height |
Sets the height of the embedded object in pixels or as a percentage of the parent container. |
name |
Specifies a name for the embedded object, which can be used for scripting purposes. |
align |
Specifies the alignment of the embedded object relative to the surrounding content. |
These are some of the main attributes of the <object>
tag that can be used to customize how the external resource is displayed within the webpage.
Summary:
In this tutorial, we have learned about the HTML <object>
tag and how it can be used to embed external resources into an HTML document. We have also discussed some of the main attributes of the <object>
tag and how they can be used to customize the appearance and behavior of the embedded object.