Path // www.yourhtmlsource.comReference → <rp>

<rp>


The <rp> element provides fallback parentheses for ruby annotations. It contains text that will be displayed by browsers that do not support the <ruby> element. In supporting browsers, the content of <rp> is hidden. This ensures graceful degradation, allowing the annotation to still be readable even when not displayed in the traditional ruby format.

Clock This page was last updated on 2025-11-17



Syntax

<ruby>
  base text
  <rp>(</rp><rt>annotation</rt><rp>)</rp>
</ruby>

The <rp> element requires both opening and closing tags. Typically, you use two <rp> elements — one containing an opening parenthesis before the <rt> and one containing a closing parenthesis after it. The closing tag can be omitted in HTML5, but explicit closing is recommended.

Attributes

  • Global attributes — The <rp> element supports all global attributes such as id, class, style, lang, and dir.

The <rp> element has no element-specific attributes. Its sole purpose is to provide fallback content.

Examples

Standard Ruby with Fallback

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

In supporting browsers: Tokyo appears with reading above
In non-supporting browsers: 東京(とうきょう)

Using Different Brackets

<ruby>
  中文
  <rp>[</rp><rt>Chinese</rt><rp>]</rp>
</ruby>

You can use any bracketing characters, not just parentheses.

Multiple Annotations

<ruby>
  富士山
  <rp>(</rp><rt>ふじさん</rt><rp>)</rp>
</ruby>

Mount Fuji (富士山) with pronunciation guide.

When to Use

Use the <rp> element when:

  • You want ruby annotations to be readable in all browsers
  • Supporting older browsers or text-only environments is important
  • Creating accessible content that degrades gracefully
  • Building multilingual educational materials

Best Practices:

  • Always include <rp> elements for maximum compatibility
  • Use standard parentheses () for conventional appearance
  • Keep the fallback text minimal — usually just opening and closing brackets
  • Test how your content appears without ruby support

Browser Behavior:

  • Supporting browsers: Content inside <rp> is hidden via display: none
  • Non-supporting browsers: Content is displayed inline, creating a readable fallback
  • Most modern browsers support ruby, but <rp> ensures backward compatibility

Why Use Parentheses?

Without <rp>, non-supporting browsers would display the base text and annotation text concatenated together, which would be confusing. The parentheses clearly indicate that the annotation is supplementary information related to the preceding text.

  • <ruby> — The container element for ruby annotations
  • <rt> — Contains the ruby text (the annotation itself)
  • <bdo> — Bidirectional text override
  • <span> — Generic inline container