HTML img align property
Examples
Set the text of the image is aligned:
try it"
Browser Support
All major browsers support align attribute.
Definition and Usage
HTML5 does not support the <img> align attribute. Use CSS instead.
In HTML 4.01, <img> The align attribute is deprecated .
align attribute specifies the alignment of the image in relation to surrounding elements.
<Img> element is an inline element (does not insert a new row on the page), which means text and other elements can be around at their surroundings. Therefore, align attributes can help us with respect to a predetermined image alignment of surrounding elements.
Compatibility Notes
In HTML 4.01, <img> The align attribute is deprecated. Use CSS instead.
CSS syntax: <img style = "float: right">
CSS Example: right-floating image
In our CSS tutorial you can find more information about the float property detail.
grammar
Property Value
值 | 描述 |
---|---|
left | 把图像对齐到左边。 |
right | 把图像对齐到右边。 |
middle | 把图像与中央对齐。 |
top | 把图像与顶部对齐。 |
bottom | 把图像与底部对齐。 |
HTML <img> tag