Easy Tutorial
❮ Prop Style Marginright Dom Obj Radio ❯

Image hspace Attribute


Definition and Usage

The hspace attribute sets or returns the value of the hspace attribute of an image.

The hspace attribute specifies the white space on the left and right edges of an image.

Syntax


Browser Support

All major browsers support the hspace attribute.


Example

The following example sets the hspace and vspace attributes of an image:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<script>
function setSpace(){
    document.getElementById("compman").hspace="50";
    document.getElementById("compman").vspace="50";
}
</script>
</head>
<body>

<img decoding="async" loading="lazy" id="compman" src="compman.gif" alt="Computerman" width="107" height="98">
<p>Some text. Some text. Some text. Some text.</p>
<input type="button" onclick="setSpace()" value="Set horizontal and vertical spacing">

</body>
</html>

❮ Prop Style Marginright Dom Obj Radio ❯