rp

Provides fallback parentheses for browsers that do not support ruby annotations.

Description

The <rp> element is used to provide fallback parentheses for browsers that do not support display of ruby annotations using the <ruby> element. The content of <rp> is typically parentheses, but can be any text that helps indicate the annotation.

In browsers that support ruby, the content of <rp> is hidden. In browsers without ruby support, it's displayed, wrapping the annotation text in parentheses (or whatever characters you provide).

Basic Example

漢字 (かんじ)
<ruby> 漢字 <rp>(</rp><rt>かんじ</rt><rp>)</rp> </ruby>

How It Renders

The <rp> element provides graceful degradation:

<!-- In browsers that support ruby --> 漢字 かんじ (annotation appears above) <!-- In browsers without ruby support --> 漢字(かんじ)

Why Use rp?

Without <rp>, browsers that don't support ruby will show confusing output:

<!-- Without rp - no fallback --> <ruby>漢字 <rt>かんじ</rt></ruby> <!-- Without ruby support, renders as: --> 漢字かんじ (confusing!) <!-- With rp - proper fallback --> <ruby>漢字 <rp>(</rp><rt>かんじ</rt><rp>)</rp></ruby> <!-- Without ruby support, renders as: --> 漢字(かんじ) (clear!)

Multiple Annotations

Each ruby text should have its own pair of rp elements:

(とう)(きょう)
<ruby> 東 <rp>(</rp><rt>とう</rt><rp>)</rp> 京 <rp>(</rp><rt>きょう</rt><rp>)</rp> </ruby>

Alternative Characters

You can use brackets or other characters instead of parentheses:

日本 [にほん]
<ruby> 日本 <rp>[</rp><rt>にほん</rt><rp>]</rp> </ruby>

Attributes

This element supports global attributes.

Accessibility

The <rp> content is typically hidden from screen readers in browsers that support ruby. In non-supporting environments, the parentheses help clarify that the text in them is an annotation of the preceding text.

Related Elements

  • <ruby> - Parent element for ruby annotations
  • <rt> - The ruby text (annotation)