web api instance property
HTMLImageElement: align property
The deprecated align property of the HTMLImageElement interface is a string which indicates how to position the image relative to its container. It reflects the <img> element’s align content attribute.
You should instead use the CSS property vertical-align, which does in fact also work on images despite its name. You can also use the float property to float the image to the left or right margin.
Value
A string whose value is one of top, middle, bottom, left, or right. For their meanings, see the HTML <img> reference.
Examples
Setting the align attribute
const img = new Image();
img.src = "example.png";
img.align = "top";
Instead of using the deprecated align property, consider setting the CSS vertical-align property instead:
const img = new Image();
img.src = "example.png";
img.style.verticalAlign = "top";
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.