Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

<bdi>

这篇翻译不完整。请帮忙从英语翻译这篇文章

Summary

HTML <bdi> 元素 (双向隔离元素) 会隔离可能以不同方向进行格式化的外部文本。

当不知道是从什么方向嵌入文本,如来自于数据库的文本(有起数据库的文本方向)的时候,该元素是十分有用的。

Though the same visual effect can be achieved using the CSS rule unicode-bidi: isolate on a <span> or another text-formatting element, the semantic meaning is only conveyed by the <bdi> element. Especially, browsers are allowed to ignore CSS styling. In such a case, the text would still be correctly displayed using the HTML element, but will become garbage when using the CSS styling to convey semantic.

Content categories Flow content, phrasing content, palpable content.
Permitted content Phrasing content.
Tag omission 不允许,开始标签和结束标签都不能省略。
Permitted parent elements Any element that accepts phrasing content.
DOM interface HTMLElement

Attributes

Like all other HTML elements, this element has the global attributes, with a slight semantic difference: the dir attribute is not inherited. If not set, its default value is the auto which let the browser decide the direction based on the element's content.

Example

<p dir="ltr">This arabic word <bdi>ARABIC_PLACEHOLDER</bdi> is automatically displayed right-to-left.</p>

Result

This arabic word REDLOHECALP_CIBARA is automatically displayed right-to-left.

Specifications

Specification Status Comment
WHATWG HTML Living Standard
<bdi>
Living Standard  
HTML5
<bdi>
Recommendation  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 16 10.0 (10.0) 未实现 未实现 未实现
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 10.0 (10.0) 未实现 未实现 未实现

See also

文档标签和贡献者

 此页面的贡献者: Ende93
 最后编辑者: Ende93,