HTML - <rp> Tag



The HTML <rp> tag stands for Ruby Fallback Parenthesis. It is used to provide fallback parenthesis around a ruby text for browsers that do not support the display of ruby annotations using the <ruby> tag.

The <rp> tag must enclose the <rt> tag with parenthesis, which contains the annotation’s text.

Using the <ruby> element, ruby annotations are used to display specific characters in numerous Asian languages.

Syntax

Following is the syntax of <rp> tag −

<rp>.....</rp>

Example

In the following example, we are creating an HTML document using the <rp> tag to enclose a ruby text.

<!DOCTYPE html>
<html>
<head>
   <style>
      ruby {
         font-size: 2em;
      }
   </style>
</head>
<body>
   <ruby> 漢 <rp>(</rp>
      <rt>kan</rt>
      <rp>)</rp> 字 <rp>(</rp>
      <rt>ji</rt>
      <rp>)</rp>
   </ruby>
</body>
</html>

On running the above code, the output window will pop up displaying the ruby annotations on the webpage.

Example

Considering the following example, we are creating an HTML document using the <rp> tag and styling it with CSS properties.

<!DOCTYPE html>
<html>
<head>
   <style>
      body {
         text-align: center;
      }

      ruby {
         font-size: 3em;
         color: green;
      }
   </style>
</head>
<body>
   <h3>Example of rp tag </h3>
   <ruby> 漢 <rp>(</rp>
      <rt>kan</rt>
      <rp>)</rp> 字 <rp>(</rp>
      <rt>ji</rt>
      <rp>)</rp>
   </ruby>
</body>
</html>

When we run the above code, it will generate an output consisting of the text applied with a CSS displayed on the webpage.

Example

Let's look at the following example, where we are going to use the <rp> element to display parenthesis to user agents that don’t support Ruby annotations.

<!DOCTYPE html>
<html>
<head>
   <style>
      body {
      text-align: center;
      }

      ruby {
      font-size: 2em;
      color: #808000;
      }
   </style>
</head>
<body>
   <h3>Example of rp tag </h3>
   <ruby> 漢 <rp>(</rp>
      <rt>かん</rt>
      <rp>)</rp> 字 <rp>(</rp>
      <rt>じ</rt>
      <rp>)</rp>
   </ruby>
</body>
</html>

On running the above code the output window will pop up displaying the ruby annotations on the webpage.

html_tags_reference.htm
Advertisements