HTML and CSS Reference
In-Depth Information
right-to-left instead of left-to-right. Use bdo when the directionality of a word or phrase
differs from the directionality set in the containing element. By default, the direction-
ality of the containing element is left-to-right. Let's look at an example using English
(even though this is all a left-to-right language, you'll be able to see the effect of the bdo
<p>When rendered by a browser, <bdo dir="rtl">these word-
s</bdo> will appear as 'sdrow
This markup renders as shown in Figure 3-12 .
Figure 3-12. The words “these words” have been reversed by the bdo element.
For a detailed overview of how to create pages that use right-to-left scripts, refer to the
following W3C internationalization tutorial:
torials/bidi-xhtml/ .
Note There is a new element called bdi that is meant for isolating a piece of text so
that it can be formatted to flow left or right completely independent of the directionality
of its surroundings. This element has yet to be implemented in any major browser, so
you'll have to wait to use it, but the idea is that it might be used when the directionality
of a particular piece of text is unknown. For example, multilingual comments left by
visitors to a blog might include text written in left-to-right and right-to-left languages,
but you wouldn't know beforehand which direction the text went in. Normally a block
of text will inherit a left-to-right or right-to-left directionality from its parent element,
but text appearing in bdi will ignore any inherited directionality settings and will set
its dir attribute to auto by default, which seeks to detect the directionality of the text
automatically based on its character set.
The goal with structured markup is to use the available elements as appropriately as pos-
sible. Sometimes the chosen elements will more closely describe their contents than oth-
er times. Sometimes the appropriate element to use will be ambiguous—in which case
close study of the specification and a careful judgement call is warranted—but HTML5
Search WWH ::

Custom Search