Web/API/HTMLImageElement/hspace

From Get docs

ObsoleteThis feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.


The obsolete hspace property of the HTMLImageElement interface specifies the number of pixels of empty space to leave empty on the left and right sides of the <img> element when laying out the page.

This property reflects the HTML hspace attribute.

Syntax

htmlImageElement.hspace = marginWidth;
marginWidth = htmlImageElement.hspace;

Value

An integer value specifying the width, in pixels, of the horizontal margin to apply to the left and right sides of the image.

Usage notes

The value specified for hspace is mapped to the margin-left and margin-right properties to specify the width of those margins in pixels.

Important: This property is obsolete. You should instead use the CSS margin property and its longhand forms to establish margins around an <img>.


Specifications

Specification Status Comment
HTML Living StandardThe definition of 'HTMLImageElement.hspace' in that specification. Living Standard
HTML 4.01 SpecificationThe definition of 'HTMLImageElement.hspace' in that specification. Recommendation Provides additional details not present in the newer specification.

Browser compatibility

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
hspace Chrome

Full support 1

Edge

Full support 12

Firefox

Full support Yes

IE

?

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support Yes

Opera Android

?

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown