HTML <rp> Tag


ATTENTION: THIS PAGE IS Valid HTML 5 AND IS BEST VIEWED WITH HTML 5 - Please upgrade your browser or download one of the HTML 5 compatible browsers such as Mozilla Firefox, Chrome, Opera or IE 9 (March 14, 2011 or later). For more information see HTML 5 browsers.

If you find this helpful, please click the Google +1 Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.)

PDF mobile

The <rp> Tag in HTML 5

The <rp> tag is used to display optional parentheses around ruby text. It is one of the formatting tags in HTML 5.

(ru) (bi)

This is an actual working example of the <rp> tag example code below, showing how the code looks in your browser. In a WebKit browser, such as Safari or Chrome, it looks like this:

ruby in webkit

In a browser that does not support the ruby element, the <rt> ruby text will be displayed with the ruby parentheses like this:

ruby parentheses

<rp> Tag Syntax

Rules for coding HTML rp elements
   ... phrasing content expected ...
   <ruby>... phrasing content ...
      <rp> (</rp><rt>... phrasing content ...</rt><rp>) </rp>
Rules for coding HTML rp elements

Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.

  1. Inside a ruby element, code the rp element for the opening ruby parenthesis immediately following the phrasing content for the base text that is to be annotated.
  2. Begin the rp element with a starting <rp> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the xmlns attribute on the <html> tag.
  3. Include any HTML global attributes on the <rp> tag as appropriate.
  4. End the rp element with a matching </rp> closing tag.
  5. Inside the rp element, between the starting <rp> tag and the ending </rp> tag, code the inner HTML phrasing content, which will usually consist of just an opening parenthesis along with optional white space.
  6. After the ending </rp> tag for the opening ruby parenthesis, code an rt element with the annotation that applies to the text just before the opening ruby parenthesis.
  7. After the ending </rt> tag of the rt element for the annotation, code another rp element with the closing ruby parenthesis. The inner HTML will usually consist of just a closing parenthesis along with optional white space.
Content Model
Content of the rp element

The content of the rp element can include HTML comments, text content and only those HTML tags that can be used in phrasing content.

<rp> Tag Attributes

Attributes of the <rp> tag
global attributes The only attributes that can be coded on the <span> tag are the common HTML attributes.

<rp> Tag Examples

Examples of the rp tag in HTML 5
Example of ruby parentheses using the HTML <rp> tag
(see <rp> tag demo above)
<ruby>&#xff99;<rp> (</rp><rt>ru</rt><rp>) </rp>&#x30d3;<rp> (</rp><rt>bi</rt><rp>) </rp></ruby>

The space adjacent to the parenthesis inside each rp element separates the parenthesized romanji text from the katakana character when the ruby parentheses are displayed in browsers that do not support the ruby and rt elements.

Changes in HTML 5 - <rp> Tag

What's new in HTML 5

The <rp> tag is one of the new elements in HTML 5.

Differences between HTML 5 and earlier versions of HTML

The <rp> tag did not exist in older versions of HTML.

The 2000-2010 Recommendations from the W3C HTML Working Group defined the HTML namespace for the names of all HTML element types, which now includes the rp element name. In older (pre-2000) versions of HTML, element type names were not associated with a namespace.

Valid HTML 5