<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>
备注
HTML 4的规范文档中没有描述该元素的事件,它们在XHTML中被添加。这应该是当时的疏忽。
规范文档
| Specification | Status | Comment |
|---|---|---|
| HTML Living Standard <bdo> |
Living Standard | |
| HTML5 <bdo> |
Recommendation | |
| HTML 4.01 Specification <bdo> |
Recommendation |
浏览器兼容
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
| Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | (Yes) | ? | ? | ? | (Yes) |