HTMLImageElement: align property - Web APIs | MDN

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

js

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:

js

const img = new Image();
img.src = "example.png";
img.style.verticalAlign = "top";

Specifications

Specification
HTML
# dom-img-align

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.