Back to Content

HTMLImageElement: hspace property

files/en-us/web/api/htmlimageelement/hspace/index.md

latest827 B
Original Source

{{APIRef("HTML DOM")}}{{deprecated_header}}

The deprecated hspace property of the {{domxref("HTMLImageElement")}} interface specifies the number of pixels of empty space to leave empty on the left and right sides of the {{HTMLElement("img")}} element when laying out the page. It reflects the `` element's hspace content attribute.

You should instead use the CSS property {{cssxref("margin")}} or its longhand properties to establish margin space around an image.

Value

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{cssxref("margin")}}
  • {{domxref("HTMLImageElement.vspace")}}