Search this site...

Controlling vertical and horizontal space

When some text wraps around an image, it may appear too close to the image. To increase the vertical and horizontal space around the image, use vspace and hspace properties inside the img tag, as shown:

<img src="http://www.scriptingmaster.com/images/html/HTML.gif" vspace="15" hspace="15">

The vspace (vertical space) property increases the vertical space above and below the image by 15 pixels. The hspace property increases the space to the left and right of the image by 15 pixels. See the following output as an example:

Some text above the image.
HTML Some text on the right.
Some text below the image.

The following is the code for the above output:

Some text above the image.<br>
<img src="../images/html/HTML.gif" width="133" height="36" border="1" alt="HTML" title="HTML" align="left" hspace="15" vspace="15"> Some text on the right. <br clear="left">
Some text below the image.