HTML: Ruby Tag (Chinese Character Annotation)

By Xah Lee. Date: . Last updated: .

What is Ruby Tag

Ruby tags are used for pronunciation markup. Mostly used for Japanese.

html ruby annotation 60465
Example of Ruby annotation rendered. (with custom CSS for font size and coloring)

here's what your browser shows:

かんじ , hàn, ㄏㄢˋㄗˋ

English Example

Here is what your browser shows:

passé /paˈsā/

Code

<span class="shadow">&lt;ruby&gt;</span>passé <span class="shadow">&lt;rt&gt;</span>/paˈsā/<span class="shadow">&lt;/rt&gt;&lt;/ruby&gt;</span>
ruby {
color:green;
font-size:2rem;
}

ruby rt {
color:red;
}

Syntax

ruby
Markup container. For above-line pronunciation annotation.
rt
used inside ruby tag, for markup pronunciation
rp
used inside ruby tag, for browsers that do not support the ruby tag.

The rp Tag

The rp tag is used to add parenthesis around the pronunciation symbols for browsers that do not support ruby.

Example:

<span class="shadow">&lt;ruby&gt;</span>
xyz <span class="shadow">&lt;rp&gt;</span>(<span class="shadow">&lt;/rp&gt;&lt;rt&gt;</span>abc<span class="shadow">&lt;/rt&gt;&lt;rp&gt;</span>)<span class="shadow">&lt;/rp&gt;</span>
<span class="shadow">&lt;/ruby&gt;</span>

what your browser shows: xyz (abc)

Browser Support