HTML

1个成员

HTML元素 - bdo

发表于 2017-02-05 4333 次查看

定义

允许作者为选定文本片断禁用双向法则。

Allows authors to disable the bidirectional algorithm for selected fragments of text.

注释

BDO 元素可用于控制文本块的阅读顺序。

Unicode 双向算法会根据所嵌入的字符序列的方向特性将其自动反转。例如,英语文档的基本方向是由左至右(ltr)。如果文档内某一段包含了阅读顺序为由右至左(rtl)的语言,你就可以应用双向算法来反转该语言的方向。

双向算法和 DIR 标签属性通常足以应付嵌入方向的变更。但是,当你将格式化后的文本交由双向算法处理时,可能会发生错误。例如,以电子邮件格式化后的包含英语和希伯莱语的文本段将被双向算法不正确地转换。由于希伯莱语文本的阅读顺序已经以电子邮件格式转换过了,对其应用双向算法则导致再一次对该文本进行转换。

BDO 元素将关闭双向算法并控制阅读顺序。当你使用 BDO 元素时必需连用 DIR 标签属性。

此元素在 Internet Explorer 5.0 及以上版本的 HTML 和脚本中可用。

此元素是内嵌元素。

此元素需要关闭标签。

The BDO element can be used to control the reading order of a block of text.

The Unicode bidirectional algorithm automatically reverses embedded character sequences according to their inherent direction. For example, the base direction of an English document is left-to-right (ltr). If portions of a paragraph within this document contain a language with the right-to-left (rtl) reading order, you can reverse the direction of that language by applying the bidirectional algorithm.

The bidirectional algorithm and the DIR attribute generally suffice for embedded direction changes. However, incorrect presentations can occur when you expose formatted text to the bidirectional algorithm. For example, a paragraph containing English and Hebrew that is formatted for e-mail could be incorrectly inverted by the bidirectional algorithm. Because the reading order of the Hebrew text was inverted once for the e-mail, exposing it to the bidirectional algorithm would invert the words a second time.

The BDO element turns off the algorithm and controls the reading order. The DIR attribute is required when you use the BDO element.

This element is available in HTML and script as of Internet Explorer 5.

This element is an inline element.

This element requires a closing tag.

示例代码

下面的例子使用 BDO 元素来纠正一个文本块的阅读顺序。

下面的字符串包含了以由左至右的英语和由右至左的希伯莱语书写的文本: This fragment is in English, WERBEH NI SI TNEMGARF SIHT.

假定由右至左的文本(WERBEH NI SI TNEMGARF SIHT.)已经转换过了,也就是说其显示方向正确。如果你继续对此文本应用 Unicode 双向算法,此文本就会被第二次转换,会以由左至左而不是由右至左的方向显示。

解决办法是覆盖双向算法,将这一个阅读顺序正确的文本块放置在 DIR 标签属性设置为 ltr 的 BDO 元素内。

This example uses the BDO element to correct the reading order of a block of text.

The following string includes text written in the left-to-right order of the English language and the right-to-left order of Hebrew: This fragment is in English, WERBEH NI SI TNEMGARF SIHT.

Assume that the right-to-left text (WERBEH NI SI TNEMGARF SIHT.) already has been inverted, so that it displays in the correct direction. If you subsequently apply the Unicode bidirectional to the text, the text inverts a second time and incorrectly displays as left-to-right instead of right-to-left.

The solution is to override the bidirectional algorithm and put the block of text in the correct reading order inside a BDO element whose DIR attribute is set to ltr.

<BDO DIR="ltr">This fragment is in English, 
    WERBEH NI SI TNEMGARF SIHT.</BDO>
发表回复
你还没有登录,请先登录注册