HTML | <object> hspace Attribute

The HTML <object> hspace Attribute is used to specify the number of whitespaces on the left and right side of an object.

Syntax:

<object hspace="pixels"> 

Attribute:



  • pixels: It specifies the number of whitespaces on the right and left side of an object in terms of pixels.

Note: The <object> hspace Attribute is not supported in HTML 5.

Below examples illsutrate the <object> hspace attribute in HTML:

Example 1: In this example the object with 50px margin on both side.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        HTML object hsapce Attribute
    </title>
</head>
  
<body>
    <center>
  
        <h1 style="color:green">GeeksforGeeks</h1>
        <h4
            HTML <object>hspace Attribute 
        </h4>
        <br>
  
        <object data=
                width="350px" height="150px" hspace="50">
            GeeksforGeeks
        </object>
    </center>
</body>
  
</html>

chevron_right


Output:

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        HTML object hsapce Attribute
    </title>
</head>
  
<body>
    <center>
  
        <h1 style="color:green">GeeksforGeeks</h1>
        <h4
         HTML <object>hspace Attribute 
        </h4>
    </center>
    <br>
  
    <div><b>With 50px hspace:</b>
        <object hspace="50">
            GeeksforGeeks
        </object>
        <object hspace="50">
            A Computer Science Portal
        </object>
    </div>
  
    <br><br>
  
    <div><b>Without hspace:</b>
        <object>
            GeeksforGeeks
        </object>
  
        <object>
            A Computer Science Portal
        </object>
    </div>
  
</body>
  
</html>

chevron_right


Output:

Supported Browsers: The browsers supported by HTML <object> hspace Attribute are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : shubham_singh



Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.