Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML img hspace attribute

HTML The hspace attribute

HTML img Tag Reference HTML tag

Example

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

Smiley faceThis is some text. This is some text. This is some text.

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the hspace attribute.


Definition and Usage

HTML5 does not support The hspace attribute. Use CSS instead.

In HTML 4.01, The hspace attribute is deprecated.

The hspace attribute specifies the whitespace on the left and right sides of the image.


Compatibility notes

In HTML 4.01, The hspace attribute is deprecated. Use CSS instead.

CSS syntax:

CSS example: image with margins

In our CSS tutorial, you can find more details about The margin attributedetails.


Syntax

Attribute values

Value Description
pixels The whitespace on the left and right sides of the image, in pixels.

HTML img Tag Reference HTML tag