bdo element overrides the bidirectional algorithm for its contents. This may be useful in situations where the bidirectional algorithm, responsible for automatically deciding the direction of a given piece of text, can be "confused" and incorrectly change the direction of text. The
bdo element prevents the bidirectional algorithm from calculating the direction of the text it contains and instructs it to just use the direction provided in the
The presence of the
dir attribute in the
bdi element is mandatory. The omission of this attribute will produce a document non-conformant with the HTML5 standard.
In the following example, there's a paragraph in english that quotes a phrase in hebrew. To be sure that everything goes as expected, we're wrapping the hebrew phrase with the
bdo element and specifying its direction as right-to-left (which we know is the right one).
<p>We may be again in one of those situations that the phrase <bdo dir="rtl">ידיעת שפה אחת אינה מספיקה</bdo> better describes.</p>
We may be again in one of those situations that the phrase ידיעת שפה אחת אינה מספיקה better describes.
For information about global attributes refer to this list of global attributes in HTML5.
For information about global events refer to this list of global events in HTML5.