<rp> Tag in HTML | Ruby Annotation
The <rp> tag in HTML is used to provide fallback text for browsers that do not support ruby annotations. Ruby annotations are used to show pronunciation guides or annotations next to text, primarily in East Asian languages.
Key Points on <rp> Tag:
- The <rp> tag is specifically used to define fallback content for the <ruby> tag.
- It ensures that when a browser does not support ruby annotations, the fallback content is displayed instead.
- Typically, <rp> is paired with the <ruby> tag, which holds the main text and its ruby annotation.
- The fallback content is usually simple text that helps users understand the intended meaning, even without the ruby text.
Syntax of <rp> Tag:
Syntax Example
<ruby>Main Text<rp>Fallback Text</rp></ruby>
Example of <rp> Tag in HTML:
This example demonstrates the usage of the <rp>
tag within a <ruby>
element for a fallback display.
Code Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML <rp> Tag Example</title>
</head>
<body>
<h1>HTML <rp> Tag Example</h1>
<p>
<ruby>漢字<rp>(Kanji)</rp></ruby>
</p>
</body>
</html>
Output
HTML
漢字
The <rp>
tag is used as a fallback for the <ruby>
tag when a browser does not support ruby annotations. It ensures that even in the absence of ruby annotations, users can see alternative text that describes the meaning or pronunciation of the main text.