<bdo>: The Bidirectional Text Override element - HTML: HyperText Markup Language 编辑
The HTML Bidirectional Text Override element (<bdo>
) overrides the current directionality of text, so that the text within is rendered in a different direction.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
The text's characters are drawn from the starting point in the given direction; the individual characters' orientation is not affected (so characters don't get drawn backward, for example).
Content categories | Flow content, phrasing content, palpable content. |
---|---|
Permitted content | Phrasing content. |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parents | Any element that accepts phrasing content. |
Implicit ARIA role | No corresponding role |
Permitted ARIA roles | Any |
DOM interface | HTMLElement Up to Gecko 1.9.2 (Firefox 4) inclusive, Firefox implements the HTMLSpanElement interface for this element. |
Attributes
This element's attributes include the global attributes.
dir
- The direction in which text should be rendered in this element's contents. Possible values are:
ltr
: Indicates that the text should go in a left-to-right direction.rtl
: Indicates that the text should go in a right-to-left direction.
Examples
<!-- Switch text direction -->
<p>This text will go left to right.</p>
<p><bdo dir="rtl">This text will go right
to left.</bdo></p>
Result
Notes
The HTML 4 specification did not specify events for this element; they were added in XHTML. This is most likely an oversight.
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of '<bdo>' in that specification. | Living Standard | |
HTML5 The definition of '<bdo>' in that specification. | Recommendation | |
HTML 4.01 Specification The definition of '<bdo>' in that specification. | Recommendation |
Browser compatibility
BCD tables only load in the browser
See also
- Related HTML element:
<bdi>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论