From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/html/element/bdi/index.html | 103 ++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 files/zh-cn/web/html/element/bdi/index.html (limited to 'files/zh-cn/web/html/element/bdi') diff --git a/files/zh-cn/web/html/element/bdi/index.html b/files/zh-cn/web/html/element/bdi/index.html new file mode 100644 index 0000000000..03d0f69f37 --- /dev/null +++ b/files/zh-cn/web/html/element/bdi/index.html @@ -0,0 +1,103 @@ +--- +title: +slug: Web/HTML/Element/bdi +tags: + - BiDi + - Element + - HTML + - HTML text-level semantics + - Reference + - Web +translation_of: Web/HTML/Element/bdi +--- +

Summary

+ +

{{HTMLRef}}
+ HTML 双向隔离元素( <bdi> ) 告诉浏览器的双向算法将其包含的文本与周围的文本隔离,当网站动态插入一些文本且不知道所插入文本的方向性时,此功能特别有用。

+ +

{{EmbedInteractiveExample("pages/tabbed/bdi.html", "tabbed-standard")}}

+ + + +

尽管同样的显示效果可以通过使用CSS规则 {{cssxref("unicode-bidi")}}:隔离{{HTMLElement("span")}}或者其他文本格式化元素,但语义信息只能通过<bdi>元素传递。特别是,当浏览器允许忽略CSS样式时,在这种情况下,使用<bdi>仍然可以保证文本正确显示,而使用CSS样式来传递语义时就显得毫无用处。

+ + + + + + + + + + + + + + + + + + + + + + + + +
Content categoriesFlow content, phrasing content, palpable content.
Permitted contentPhrasing content.
Tag omission{{no_tag_omission}}
Permitted parent elementsAny element that accepts phrasing content.
DOM interface{{domxref("HTMLElement")}}
+ +

属性

+ +

{{htmlattrdef("dir")}}

+ +

如同其他HTML元素一样,它包含全局属性,但是有一些语义上的细微差别:dir属性不继承父元素。如果没有设置,默认值即为auto,以便浏览器根据元素内容决定元素内容的方向。

+ +

示例

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

结果

+ +

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

+ +

规范

+ + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'text-level-semantics.html#the-bdi-element', '<bdi>')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5 W3C', 'the-bdi-element.html#the-bdi-element', '<bdi>')}}{{Spec2('HTML5 W3C')}}
+ +

浏览器兼容

+ + + + + +

{{Compat("html.elements.bdi")}}

+ + + +

参见

+ + -- cgit v1.2.3-54-g00ecf