Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

How to set the name for the object in HTML5?

  • Last Updated : 26 Mar, 2021

<object> element in HTML5 is used to link any external files and resources in the form of any image or any nested linked webpages or content or any plugin that can do the same work.

Syntax:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

<object name="name"></object>

Elementary uses of <object/ element:

Initially <object> is designed to embed the different applications and browser plugins within it, which is mostly used to extend the usability of browsers.



The attributes that can be passed within this element:

AttributeValueDescription
dataURLIt specifies the URL of data in the object.
typemedia_typeIt specifies the media type of data specified in the data attribute.
typemustmatchbooleanIt indicates that the resource should be embedded only if the value of the type attribute matches with the type of resource provided on the data attribute.
alignleft, right, top, bottomIt defines the alignment of the objects.
borderpixelsIt specifies the border around the object.
heightpixelsIt specifies the height of the object.
hspacepixelsIt specifies the white space on the left and right sides of the object.
vspacepixelsIt specifies the white space on the top and bottom of the object.
widthpixelsIt specifies the width of the object.
namenameIt specifies the name of an object.
formform_idIt specifies the form id to which the object element belongs to.

Example: Here is the sample code which has objected to link image, video, and any HTML link of some other webpage:

HTML




<!DOCTYPE html>
<html>
  
<body>
  
    <h1>Example of an object element in HTML5</h1>
    <label>1.Image Example</label><br>
    <object data=
            width="400" 
            height="300" 
            border="2" 
            name="obj1"></object><br><br>
    <label>2.Webpage Example</label><br>
    <object data="https://www.geeksforgeeks.org/" 
            width="400" 
            height="300" 
            border="2" 
            name="obj2"></object><br><br>
    <label>3.Video Example</label><br>
    <object data=
            width="400" 
            height="300" 
            border="2" 
            name="obj3"></object>
  
</body>
  
</html>





My Personal Notes arrow_drop_up
Recommended Articles
Page :