Last Updated : 27 Feb, 2024
The HTML <img> vspace Attribute is used to specify the number of whitespaces on bottom and top side of an image.
Note: The HTML vspace Attribute not supported by HTML5
Syntax:<img vspace="pixels">Attribute Values:
pixels: It specifies the number of whitespaces on top and bottom of an image in terms of pixels.
Example:
html
<!DOCTYPE html>
<html>
<head>
<title>
HTML img vspace Attribute
</title>
<style>
h1, h2 {
color:green;
text-align:center;
}
h3 {
font-weight:bold;
}
</style>
</head>
<body>
<h1 style="color:green;">
GeeksforGeeks
</h1>
<h2>HTML <img> vspace Attribute</h2>
<h3>Image without vspace Attribute</h3>
<p>
<img id="myImage" src=
"https://media.geeksforgeeks.org/wp-content/uploads/gfg-40.png"
alt="Submit" width="42"
height="42" align="middle"/>
It is a computer science portal for geeks
</p>
<h3>Image with vspace Attribute</h3>
<p>
<img id="myImage" src=
"https://media.geeksforgeeks.org/wp-content/uploads/gfg-40.png"
alt="Submit" vspace = "60"
width="42" height="42"
align="middle"/>
It is a computer science portal for geeks
</p>
</body>
</html>
Output:
Supported Browsers: The browser supported by HTML <img> vspace 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