HTML <rp> Element
The HTML <rp> element provides fallback parentheses or other characters around a ruby annotation when a browser does not support ruby text formatting.
Syntax
<ruby>
漢 <rp>(</rp><rt>かん</rt><rp>)</rp>
</ruby>
The <rp> element is used inside a <ruby> element alongside an <rt> element. It normally contains an opening or closing parenthesis that is displayed only when ruby annotations are not rendered using ruby formatting.
Attributes
The <rp> element supports the global HTML attributes. It does not have any element-specific attributes.
Example
This example uses <rp> elements to provide parentheses around the pronunciation contained in the <rt> element when ruby formatting is unavailable.
Usage Notes
The <rp> element is intended for use with ruby annotations, which are commonly used to provide pronunciation or explanatory text for East Asian characters.
In browsers that support ruby formatting, the contents of <rp> elements are normally hidden and the <rt> annotation is positioned according to the browser's ruby layout rules.
In a browser that does not support ruby formatting, the <rp> content provides visible punctuation around the annotation so the relationship between the base text and annotation remains understandable.
The <rp> element is optional. It is useful primarily when fallback presentation for browsers without ruby support is desired.
Accessibility
Ruby annotations can provide pronunciation or explanatory information that helps readers understand unfamiliar characters. The <rp> element helps keep that annotation understandable when ruby-specific formatting is unavailable.
Use meaningful annotation text inside the <rt> element and use <rp> only for fallback punctuation rather than placing the annotation itself inside the <rp> element.
Browser Support
Baseline: Widely available indicates a feature has been supported by core browsers for at least 30 months. At this stage, the feature is considered stable and safe for most websites to use without needing to worry about compatibility issues or fallbacks, as it is supported by the vast majority of users' devices and browser versions.
For detailed browser compatibility information, see Can I Use: HTML <rp> Element .
Related Elements
The <rp> element is closely related to the <ruby> element that contains ruby annotations and the <rt> element that provides the annotation text.
