Last Updated : 17 Apr, 2025
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:
Note: The <object> hspace Attribute is not supported in HTML 5.
Below examples illustrate the <object> hspace attribute in HTML:
Example 1: In this example the object with 50px margin on both side.
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>
<br>
<object data=
"https://www.geeksforgeeks.org/wp-content/uploads/Geek_logi_-low_res.png"
width="350px" height="150px" hspace="50">
GeeksforGeeks
</object>
</center>
</body>
</html>
Output:
Example 2:
<!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>
</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>
Output:
Supported Browsers: The browsers supported by HTML <object> hspace Attribute are listed below:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4