HTMLImageElement.align - Web APIs 编辑

Obsolete

This 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 align property of the HTMLImageElement interface is a string which indicates how to position the image relative to its container. You should instead use the CSS propertiy 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.

The align property reflects the HTML align content attribute.

Syntax

htmlImageElement.align = alignMode;
alignMode = htmlImageElement.align;

Value

A DOMString specifying one of the following strings which set the alignment mode for the image.

Baseline alignment

These three values specify the alignment of the element relative to the text baseline. These should be replaced by using the CSS vertical-align property.

bottom
The bottom edge of the image is to be aligned vertically with the current text baseline. Default value.
middle
The center of the object should be aligned vertically with the current baseline.
top
The top edge of the object should be aligned vertically with the current baseline.

It may be worth noting that vertical-align offers several additional options for its value; you may wish to consider these when changing your code to use it.

Floating images horizontally

The left and right properties don't affect the baseline-relative alignment. Instead, they cause the image to "float" to the left or right margin, allowing the following text to flow around the image. You should instead use the CSS float property, specifying as the value either left or right.

left
Floats the image over to place the left edge flush against the curent margin. Any text that follows will flow against the image's right edge.
right
Floats the image to place its right edge flush against the right margin. Subsequent text will flow along the image's left edge.

Specifications

SpecificationStatusComment
HTML Living Standard
The definition of 'HTMLImageElement.align' in that specification.
Living Standard
HTML 4.01 Specification
The definition of 'HTMLImageElement.align' in that specification.
Recommendation

Browser compatibility

BCD tables only load in the browser

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:109 次

字数:4302

最后编辑:8 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文