Easy Tutorial
❮ Av Prop Defaultmuted Colors Mixer ❯

HTML <img> hspace Attribute

HTML <img> Tag

Example

An image with 20 pixels of margin on the left and right:


Browser Support

All major browsers support the hspace attribute.


Definition and Usage

In HTML 4.01, the hspace attribute of <img> is deprecated.

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


Compatibility Notes

In HTML 4.01, the hspace attribute of <img> is deprecated. Use CSS instead.

CSS syntax: <img style="margin: 0px 20px">

CSS Example: Image with Margin

In our CSS tutorial, you can find more details about the margin property.


Syntax

Attribute Values

Value Description
pixels The white space on the left and right of the image, measured in pixels.

❮ Av Prop Defaultmuted Colors Mixer ❯