Latest web development tutorials

HTML DOM Image vspace property

Image Object Reference Image Object

Definition and Usage

vspace property sets or returns a blank top and bottom of the image.

space and vspace attributes can be used with align, to set the distance between the image and the surrounding text.

grammar

imageObject.vspace=pixels


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support vspace attribute


Examples

Examples

The following example will set the hspace and vspace attributes 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" 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"


Image Object Reference Image Object