W3docs

HTML <rb> Tag

Use the HTML <rb> tag to delimit the base text component of <ruby> annotations that are often used in East Asin typography. See examples and try them yourself.

The HTML <rb> element was used to delimit the base text component of a <ruby> annotation — the characters that a pronunciation guide is attached to.

Warning

Deprecated — do not use <rb> in new code. The <rb> element has been removed from the HTML standard, and browser support is unreliable. There is no need for it: in modern HTML the base text is placed directly inside <ruby>, with no wrapper element. This page is kept only to help you recognize and migrate away from legacy markup.

What ruby annotations are

A ruby annotation is a short run of text presented alongside a base run of text, typically used in East Asian typography to show the pronunciation (reading) of characters. The annotation is rendered in a smaller font, usually above or to the side of the base characters.

A ruby annotation is built from three modern elements:

  • <ruby> — the container for the whole annotation.
  • <rt> — the ruby text: the pronunciation/annotation itself.
  • <rp> — optional ruby parentheses shown only by browsers that cannot render ruby, so the text degrades to something like 漢字 (kanji).

In old markup, <rb> (and the also-deprecated <rtc>) wrapped the base text. Today the base text needs no wrapper at all.

The modern pattern (use this)

Put the base text straight inside <ruby>, then follow each base segment with its <rt>. Wrap the <rt> content in <rp> parentheses so the annotation still reads sensibly where ruby isn't supported.

Example of a modern ruby annotation (no <rb>):

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      body {
        font-size: 30px;
      }
    </style>
  </head>
  <body>
    <ruby>
      漢 <rp>(</rp><rt>kan</rt><rp>)</rp>
      字 <rp>(</rp><rt>ji</rt><rp>)</rp>
    </ruby>
  </body>
</html>

Result

HTML ruby annotation example

A browser that supports ruby renders kan above and ji above . A browser that does not falls back to 漢 (kan) 字 (ji), thanks to the <rp> elements.

Legacy <rb> markup (recognize, do not use)

You may still encounter older documents that wrap each base segment in <rb>. The example below is shown only so you can recognize it — replace it with the modern pattern above.

<!-- Legacy markup — DO NOT USE in new code -->
<ruby>
  <rb>漢</rb>
  <rb>字</rb>
  <rp>(</rp><rt>kan</rt><rt>ji</rt><rp>)</rp>
</ruby>

To migrate, drop the <rb> tags and leave the base characters directly inside <ruby>.

Browser support

<rb> is not part of the current HTML specification. Even where browsers tolerate it, behavior is inconsistent, so you should not rely on it. The modern <ruby> / <rt> / <rp> combination is well supported across current browsers.

  • <ruby> — the ruby annotation container.
  • <rt> — the ruby (annotation) text.
  • <rp> — fallback parentheses for non-supporting browsers.

Practice

Practice
Which statements about the deprecated <rb> tag and modern ruby annotations are correct?
Which statements about the deprecated <rb> tag and modern ruby annotations are correct?
Was this page helpful?