A Ruby is part of an annotation pair - a piece of text ("Ruby Text") that is
associated with another piece of text known as a "Ruby Base". A common
need for such a structure arises in some asian writing systems where a ruby
association is used to present helper readings for uncommonly used writing
With a character set as complex as Chinese or Japanese, some characters are used
rarely and are thus not as easily recognizable by younger children or possibly
many adults. In Japanese writing, for example, the phonetic Hiragana alphabet
is used to pair phonetic 'helper' readings (called Furigana or Yomigana in
Japanese) with the Chinese character counterpart.
A Ruby text will usually be rendered next to the Base text such that the
association between each Base text and Ruby text is clear (often directly
above the Base text.) Ruby text is usually also rendered in a smaller font
than the Base text to help visually clarify which part is which in the
Ruby markup has two main usage modes in XHTML - Simple Rubies, where
a single annotation or helper text is associated with a single piece of
Base text, and Complex Rubies, where as many as two Ruby text annotations
can be bound to a single piece of Base text. Complex Rubies also allow
Base text and Ruby text to be broken down further, so that even more
detailed associations can be made between them.
Simple Rubies will often be the only type of annotation mechanism that most
authors need. In this type of ruby markup, two main elements exist nested
in the RUBY element - the Base text (the RB element),
followed by the Ruby text (the RT element.)
For browsers that do not understand the RUBY markup, they will display the
content of the RT element directly following the contents of the RB content.
Since this sort of fallback may not be enough to distinguish the association
relationship between the two content pieces, one final, optional fallback
element is provided to make the association clear in non-supporting browser
scenarios: the RP element. An RP element containing
a single character (usually an open or close parenthesis, depending on
the context - RP DOES stand for Ruby Parenthesis...) should
be put on either side of the RT element. Ruby-supporting browsers should
ignore the RP element completely and not render it in any way; in
non-supporting browsers however, the contents of the RP element will surround
the RT content to tie the content with the previous RB content.
Complex rubies can have multiple Base elements, and multiple Ruby Text
components. In a Complex Ruby, all of the Base elements (RB)
are enclosed in an RBC element (RBC: Ruby Base
Container.) For the Ruby Text elements (RT), these
are enclosed in an RTC element (RTC: Ruby Text
Container.) A Complex Ruby can have one or two RTC elements which allows
for two text associations to be given for any given Base text. Default
rendering might render the first RTC group ABOVE the Base text,
with the second RTC group possibly rendered BELOW the Base text...
but, this rendering is definitely not guaranteed - allowances for alternate
writing directions (eg: vertical rather than horizontal) and other criteria
can complicate rendering, and CSS properties have already been proposed
specifically for Ruby markup in future CSS versions to control these details.
The content of the Ruby Base Container (RBC) is, of course, RB elements.
Similarly, the content of any Ruby Text Containers (RTC) are RT elements.
With Complex Rubies, RT elements have an additional attribute RBSPAN which
acts like COLSPAN does for TD and TH elements in tables - it allows a
piece of Ruby Text content to be associated with multiple RB base elements.
The name "Ruby" came from British printing; "Ruby" was the name of the 5.5pt
small font used for annotation purposes, relative to the normal 10pt font
commonly used for normal text.
Structurally and visually, Rubies could also be approximately rendered using
tables and row/colspans. But if a table is used, the semantic meaning of the
content association is lost.
The RP element was not designed to be used in Complex Ruby authoring situations.
The RP element was meant to be a simple fallback mechanism, and it is not suited
to the complexity of the Complex Ruby usage scenario.
Internet Explorer 5.0 Beta 2: The RB element was
documented for this version, but this documentation was dropped for
the final version of Internet Explorer 5.0. The way Rubies are currently
implemented in IE makes the omission of the RB element rather harmless.
IE: If RT content exists before the RUBY content, the RT content is rendered
small, but inline before the RUBY content.
IE 5+: While Block elements can exist within a Ruby element, some interesting
behaviors are apparent. Images render fine also, but not form widgets.