HTML Reference Β· Inline Text
The <rp> element
Reference for the HTML <rp> element: fallback parentheses around ruby annotations for browsers without ruby support, with examples and technical details.
The <rp> element (ruby parenthesis) holds punctuation, usually a pair of parentheses, that is shown only when a browser cannot lay out ruby annotations. Browsers that support <ruby> hide <rp> completely; others show the annotation inline, and the <rp> content keeps it readable, as in "ζ±δΊ¬(γ¨γγγγ)".
<ruby>ζ±δΊ¬<rp>(</rp><rt>γ¨γγγγ</rt><rp>)</rp></ruby>
Try it
The second line forces every part to display: inline, which is roughly what an old browser does. The parentheses from <rp> appear and keep the reading separate from the base text.
Attributes
This element has no attributes of its own. It accepts the global attributes.
Usage notes
- Wrap each
<rt>. Put one<rp>with the opening mark before the<rt>and one with the closing mark after it. - Any punctuation works. Parentheses are the usual choice, but brackets or full-width parentheses (
οΌandοΌ) suit Japanese and Chinese text well. - Text only.
<rp>holds plain text; don't put elements inside it. - Is it still needed? Every current browser supports ruby, so
<rp>mostly helps with text-only tools, feed readers, copy-and-paste and some assistive technologies that ignore ruby layout. It costs little and makes the content more robust. - End tag is optional. You may leave out
</rp>when it is followed directly by an<rt>or another<rp>, or when it is the last thing in its parent.
Technical summary
| Content categories | None |
| Permitted content | Text |
| Tag omission | The end tag may be omitted if the <rp> is immediately followed by an <rt> or <rp> element, or if there is no more content in the parent |
| Permitted parents | A <ruby> element, directly before or after an <rt> |
| Implicit ARIA role | No corresponding role |
| DOM interface | HTMLElement |
| Default display | none |
Browser support
Supported in every browser; ruby-aware browsers hide it, and the rest display its text.
Related
<ruby>β the ruby container<rt>β the annotation text- Lesson: Times, Data Values and Ruby Text