Image vspaceProperty
Image Object
Definition and Usage
The vspace property sets or returns the whitespace at the top and bottom of an image.
The space and vspace properties can be used with align to set the distance between the image and the surrounding text.
Syntax
imageObject.vspace=pixels
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the vspace property.
Examples
Examples
The following example sets the hspace and vspace properties of an image:
<html>
<head>
<script>
function setSpace()
{
document.getElementById("compman").hspace="50";
document.getElementById("compman").vspace="50";
}
</script>
</head>
<body>
<img id="compman" src="compman.gif.html" alt="Computerman">
<p>Some text. Some text. Some text. Some text.</p>
<input type="button" onclick="setSpace()" value="Set hspace and vspace">
</body>
</html>
<head>
<script>
function setSpace()
{
document.getElementById("compman").hspace="50";
document.getElementById("compman").vspace="50";
}
</script>
</head>
<body>
<img id="compman" src="compman.gif.html" alt="Computerman">
<p>Some text. Some text. Some text. Some text.</p>
<input type="button" onclick="setSpace()" value="Set hspace and vspace">
</body>
</html>
Try it Yourself »
Image Object Other Extensions