Latest web development tutorials

HTML img hspace property

HTML img tag Reference Manual HTML <img> tag

Examples

The left and right margins of 20 pixels:

<p><img src="smiley.gif" alt="Smiley face" width="42" height="42" align="middle" hspace="20">这是一些文本。这是一些文本。这是一些文本。</p>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support hspace attribute.


Definition and Usage

HTML5 does not support the <img> hspace property. Use CSS instead.

In HTML 4.01, <img> the hspace attribute obsolete .

hspace attribute specifies a blank image left and right.


Compatibility Notes

In HTML 4.01, <img> the hspace attribute obsolete. Use CSS instead.

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

CSS Example: with a margin image

In our CSS tutorial you can find more information about the margin property detail.


grammar

<img hspace="pixels">

Property Value

描述
pixels 图像左侧和右侧的空白,以像素计。


HTML img tag Reference Manual HTML <img> tag