HTML and CSS Reference
In-Depth Information
Handling foreign scripts
Several elements exist for the purpose of displaying the different formatting require-
ments and semantics of written scripts from around the world. While the Latin alphabet
(used in English) has had a predominant presence on the Web for many years, as a global
phenomenon the Web needs to be able to handle different alphabets correctly. The ele-
ments that follow will help format ruby notation and bidirectional text.
Ruby notation: ruby, rt, and rp
Ruby refers to a fragment of text that has an association with another fragment of text,
known as the base text —it is most often used to provide a short annotation of the base
text, or a pronunciation guide, and is used in East Asian typography. Typically it is
presented with the ruby text appearing above the base text, but browser support varies,
as shown in Figure 3-11 .
Figure 3-11. Ruby text rendered in (l to r), Safari, Chrome, Firefox
The text in Figure 3-11 has the following HTML source:
<ruby>
This is ruby base <rp>(</rp><rt>This is ruby tex-
t</rt><rp>)</rp>
</ruby>
As you can see, the top text is specified in the rt element. The rp element is for de-
fining backup content for browsers that don't support ruby. In this case, they're used for
setting up parentheses that show up on Firefox ( Figure 3-11 ).
Note For more information on ruby notation, refer to the W3C Ruby Notation spe-
cification at www.w3.org/TR/ruby/ .
Text direction: bdo and bdi
If you are marking up text in a foreign language, then you may find use for the bdo
element (that's “bidirectional override”) and the dir attribute (which is required for this
element). bdo controls the direction of a text fragment and a block of text, respectively,
and is best used when marking up Arabic and other languages that are written from
 
Search WWH ::




Custom Search