<rp>

Fallback parentheses around a ruby annotation, visible only where ruby isn’t supported.

Display
none
Closing tag
Required
Permitted content
Text, usually a single parenthesis
On this page

Example

#
HTML
<p lang="zh" style="font-size: 2rem;">
  <ruby>中<rp>(</rp><rt>zhōng</rt><rp>)</rp>文<rp>(</rp><rt>wén</rt><rp>)</rp></ruby>
</p>
<p>Without ruby support, this would display as: 中(zhōng)文(wén)</p>
Preview

Definition and usage

#

The <rp> element (from ruby parenthesis) holds a parenthesis or other character that surrounds an <rt> annotation. Browsers that support ruby hide it, so the annotation appears above the text, without parentheses.

When a program doesn’t understand ruby, it displays everything on one line. Without <rp>, the text would run together into the unreadable string "中zhōng文wén," while with the parentheses it looks like this: "中(zhōng)文(wén)."

All major browsers support ruby today, so <rp> is a safeguard for programs that display HTML in a simplified way. Place it right before and right after every <rt>.

Syntax

#
Syntax
<ruby>字<rp>(</rp><rt>zì</rt><rp>)</rp></ruby>

Attributes

#

This element has no attributes of its own. It supports the global attributes, such as class, id and hidden.

Default CSS

#

Most browsers display this element with these default styles:

CSS
rp {
  display: none;
}

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • Add <rp> in pairs: an opening one before <rt>, a closing one after it.
  • Instead of round parentheses, you can use other characters, e.g. square brackets.
  • <rp> only makes sense inside <ruby>.

Related entries

#

Spotted a mistake or missing an example? Write to us.