<bdo>

<bdo> 元素 (HTML双向覆盖元素)用于覆盖当前文本的朝向,它使得字符按给定的方向排列。

 

 

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 Up to Gecko 1.9.2 (Firefox 4) inclusive, Firefox implements the HTMLSpanElement interface for this element.

属性

这个标签包含 全局属性.

dir
这个标签包含文本的文本方向. 属性值可为:
  • ltr: 从左往右写,与现代汉语的书写习惯相同.
  • rtl: 从右往左写,与古代汉语书写习惯相同.

示例

<!-- 改变文本方向 -->
<p>This text will go left to right.</p>
<p><bdo dir="rtl">This text will go right 
to left.</bdo></p>

 

 

Result

 

备注

HTML 4的规范文档中没有描述该元素的事件,它们在XHTML中被添加。这应该是当时的疏忽。

规范

规范 状态 注释
HTML Living Standard
<bdo>
Living Standard  
HTML5
<bdo>
Recommendation  
HTML 4.01 Specification
<bdo>
Recommendation  

浏览器兼容

 

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
bdoChrome Full support YesEdge Full support YesFirefox Full support YesIE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support