HTML: Ruby Tag (character annotation)

By Xah Lee. Date: . Last updated: .

HTML tags for ruby annotation

Ruby is pronunciation annotation for mostly Chinese and Japanese languages.

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.

Example. English

browser shows

café/kaˈfeɪ/

Code

<ruby>café<rt>/kaˈfeɪ/</rt></ruby>
ruby {
 font-size: 2rem;
}
ruby rt {
 color: green;
}

Example

Example. Chinese with pinyin

hàn

<p><ruby>汉<rt>hàn</rt>字<rt>zì </rt></ruby></p>

Example. Japanese

かん

<p><ruby>漢<rt>かん</rt>字<rt>じ</rt></ruby></p>

The rp tag

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

Example

<ruby>
xyz <rp>(</rp><rt>abc</rt><rp>)</rp>
</ruby>

what your browser shows:

xyz (abc)

Browser support