HTML <object> hspace Attribute
The HTML <object> hspace Attribute is used to specify the number of whitespaces on the left and the right side of the object.
Syntax:
<object hspace="pixels">
Attribute Value:
- pixels: It specifies the number of whitespaces in terms of pixels.
Note: The <object> hspace Attribute is not supported in HTML 5.
Example: The below HTML code illustrates the use of the hspace attribute with <object> element.
HTML
<!DOCTYPE html><html> <head> <title>HTML object hspace Attribute</title></head> <body> <center> <h1 style="color: green"> GeeksforGeeks </h1> <h4>HTML <object>hspace Attribute</h4> <h3 style="font-weight: bold"> Without using hspace Attribute </h3> <p> <object data= width="150px" height="50px"> GeeksforGeeks </object> A Good platform for earning and learning. </p> <h3 style="font-weight: bold"> Using with hspace Attribute </h3> <p> <object data= width="150px" height="50px" hspace="50"> GeeksforGeeks </object> A Good platform for earning and learning. </p> </center></body> </html> |
Output:

Example 2: The below code example illustrates the hspace attribute between two objects.
HTML
<!DOCTYPE html><html> <head> <title>HTML object hspace Attribute</title></head> <body> <center> <h1 style="color: green"> GeeksforGeeks </h1> <h3>HTML object hspace Attribute</h3> <b>With hspace: 50</b> <div> <object data= width="150px" height="100px" hspace="50"> </object> <object data= width="150px" height="100px" hspace="50"> </object> </div> </center></body> </html> |
Output:

Supported Browsers:
- Google Chrome
- Internet Explorer
- Microsoft Edge
- Firefox
- Safari
- Opera


