If you find this helpful, please click the Google 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.) |
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.
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:
In a browser that does not support the ruby element, the <rt> ruby text will be displayed with the ruby parentheses like this:
<rp> Tag Syntax
Rules for coding HTML rp
elements
<body> ... ... phrasing content expected ... <ruby>... phrasing content ... <rp> (</rp><rt>... phrasing content ...</rt><rp>) </rp> ... </ruby> ... </body>
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.
- 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.
- 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. - Include any HTML global attributes on the <rp> tag as appropriate.
- End the rp element with a matching
</rp>
closing tag. - 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. - 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.
- 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>ル<rp> (</rp><rt>ru</rt><rp>) </rp>ビ<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.