Open In App

HTML <Object> tag

Last Updated : 26 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The <object> tag is used to display multimedia like audio, videos, images, PDFs, and Flash on web pages. It can also be used for displaying another webpage inside the HTML page. The <param> tag is also used along with this tag to define various parameters. Any text that is written within <object> and </object> tags is considered as an alternative text that appears when the data specified is not supported by the browser. 

Note: The <object> tag indeed supports Global Attribute and Event attributes, allowing for various attributes and event handlers to be applied.

Attributes:

Attribute Value Description
data URL It specifies the URL of data in the object.
type media_type It specifies the media type of data specified in the data attribute.
typemustmatch boolean It indicates that the resource should be embedded only if the value of the type attribute matches with the type of the resource provided on the data attribute.
align left, right, top, bottom It defines the alignment of the objects.
border pixels It specifies the border around the object.
height pixels It specifies the height of the object.
hspace pixels It specifies the whitespace on the left and right side of the object.
vspace pixels It specifies the whitespace on the top and bottom of the object.
height pixels It specifies the height of the object.
width pixels It specifies the width of the object.
name name It specifies the name for an object.
form form_id It specifies the form id to which the object element belongs to.

Example 1: In this example, we will see the implementation of an object tag with an example.

HTML




<!DOCTYPE html>
 
<html>
 
<body>
    <h1>HTML Object Tag</h1>
   
    <!--HTML object tag starts here-->
   
    <object data=
            width="550px" height="150px">
        GeeksforGeeks
    </object>
   
    <!--HTML object tag ends here-->
   
</body>
 
</html>


Output: 
 

Example 2: In this example, we will see the implementation of an object tag with another example.

HTML




<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0">
    <title>HTML Object Tag Example</title>
    <style>
        body {
            text-align: center;
        }
    </style>
</head>
 
<body>
    <h1>Embedding an Image Using <code><object></code> Tag</h1>
 
    <object data=
            type="image/png">
        <img src=
             alt="Placeholder Image">
    </object>
</body>
 
</html>


Output:

Screenshot-2023-12-15-153921

Supported Browsers 

  • Google Chrome 1
  • Edge 12
  • Firefox 1
  • Opera 15
  • Safari 3
     


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads