bdo ... ⁄bdo
HTML5 bdo element
The bdo element allows you to override the directionality of a text set by the Unicode BIDI algorithm (Unicode Bidirectional Algorithm) »video.
If a span of text, according to BIDI algorithm, is RTL aligned, you can LTR align it through bdo element, dir attribute, value "ltr".
About bdo
- is an optional element
- multiple bdo elements allowed per HTML5 document
Parents, children bdo
- bdo nested within elements »bdo parents
- elements nested within bdo »bdo children
»examples
Attributes bdo
- required: dir
- optional: global attributes, event attributes
Observation: dir global attribute on bdo element will override text directionality set by the BIDI algorithm.
Syntax bdo
1 | <> ... </> »video |
Attributes and Values bdo (comma separated)
< | attribute | = | "attribute_value(s)" | > | Video | Examples |
---|---|---|---|---|---|---|
1. specific attributes | ||||||
All Specific Attributes | ||||||
2. global attributes | ||||||
1. | accesskey | = | keyboard key | »img | <accesskey="h"> ... </ > | |
2. | class | = | class name | »html »img | <class="class_name"> ... </ > | |
3. | contenteditable | = | "", , true, false | »html | <contenteditable="true"> ... </ > | |
4. | contextmenu | = | menu id value | »html | <contextmenu="menu_id_value"> ... </ > | |
5. | data-* | = | value | - | <data-http-error="404"> ... </ > | |
6. | dir | = | ltr, rtl, auto | »html | <dir="ltr"> ... </ > | |
7. | draggable | = | true, , false | »img | <draggable="false"> ... </ > | |
8. | dropzone | = | copy, move, link, string:, file: | - | <dropzone="copy"> ... </ > | |
9. | hidden | = | "", , hidden | »html »img | <hidden="hidden"> ... </ > | |
10. | id | = | id name | »html »img | <id="unique_id_name"> ... </ > | |
11. | itemid | = | URL | - | - | |
12. | itemprop | = | string | »link »a | - | |
13. | itemref | = | string | - | - | |
14. | itemscope | = | "", , itemscope | - | - | |
15. | itemtype | = | absolute URL | - | - | |
16. | lang | = | language code | »html »head»title »img | <lang="en"> ... </ > | |
17. | spellcheck | = | "", , true, false | »html | <spellcheck="true"> ... </ > | |
18. | style | = | CSS property:value | »html »img | <style="color:red"> ... </ > | |
19. | tabindex | = | integer | »img | <tabindex="3"> ... </ > | |
20. | title | = | text | »html »link»style »abbr»dfn »img »meter | <title="html page"> ... </ > | |
21. | translate | = | "", yes, no | »html »img | <translate="yes"> ... </ > | |
All Global Attributes | ||||||
3. global event attributes | ||||||
1. | onclick | = | script | » list | <element onclick="script" > ... | |
2. | ondblclick | = | script | » list | <element ondblclick="script" > ... | |
All Event Attributes |
Video demonstration bdo element
HTML5 bdo element: override text directionality
min | video details |
---|---|
00:00 | video tutorial: bdo element |
00:01 | bdo element allows you to override the directionality of a text set by the Unicode Bidirectional Algorithm (BIDI) |
00:09 | as result of the BIDI algorithm, this text will be left-to-right aligned (Latin text) |
00:11 | and this text will be right-to-left aligned (Arabic text) |
00:22 | thus we have: - left-to-right (first paragraph) and - right-to-left (second paragraph) |
00:26 | with bdo element, we can override these directionalities set by the BIDI algorithm |
00:33 | dir attribute is required as its value indicates the new directionality: ltr (for left-to-right) or rtl (for right-to-left) |
00:53 | before adding the bdo element, the arabic text was right-to-left aligned |
00:57 | after adding bdo dir="ltr", the arabic text is left-to-right aligned |
01:03 | adding the bdo element to the first paragraph too in order to change text directionality through dir attribute |
01:07 | so basically if BIDI sets a text as LTR, we can override it like this: bdo dir="rtl" |
01:20 | before adding bdo, the latin text was left-to-right LTR aligned |
01:24 | after adding bdo dir="rtl", the latin text is right-to-left RTL aligned |