HTML <rtc>
Tag
The <rtc>
tag in HTML defines a container for the ruby text component of a ruby annotation. Ruby text provides pronunciation, translation, or other forms of annotation alongside base text, commonly used in East Asian typography. The <rtc>
tag is a crucial part of this annotation system, encapsulating the supplementary text to enhance readability and understanding. It's crucial for providing detailed information alongside base text.
Syntax
<ruby>
<rb>base text</rb>
<rt>ruby text</rt>
<rtc>ruby text container</rtc>
</ruby>
Attributes
Attribute | Value | Description |
---|---|---|
None | None | The <rtc> tag does not have any specific attributes. It relies on its placement within the <ruby> structure to function correctly. |
Example
<ruby>
<rb>ζ±δΊ¬</rb>
<rt>γ¨γγγγ</rt>
<rtc>TΕkyΕ</rtc>
</ruby>
More Examples
Example 1: Basic Ruby Text with Container
This example demonstrates the basic usage of <rtc>
to provide an alternative annotation for the ruby text.
<ruby>
<rb>ζΌ’ε</rb>
<rt>γγγ</rt>
<rtc>Kanji</rtc>
</ruby>
In this case, "ζΌ’ε" (kanji) is annotated with its pronunciation "γγγ" (kanji) and the additional annotation "Kanji" as an rtc container
Example 2: Using with Pronunciation Guides
Here, we're using <rtc>
to provide a phonetic guide alongside the primary ruby text. This approach is useful for learning materials and when different types of annotations are needed.
<ruby>
<rb>δ½ ε₯½</rb>
<rt>nΗ hΗo</rt>
<rtc>Ni hao</rtc>
</ruby>
This shows "δ½ ε₯½" (nΗ hΗo) with the pronunciation guide "nΗ hΗo" and the container with its phonetics: "Ni hao"
Example 3: Multiple <rtc>
Tags
It is valid to have more than one <rtc>
tag, useful when you need multiple context, one with pronunciation guide, and another for its meaning
<ruby>
<rb>ε
η</rb>
<rt>γγγγ</rt>
<rtc>sensei</rtc>
<rtc>Teacher</rtc>
</ruby>
Here, two containers are used, one with the romanization (sensei) and the other with its translation (Teacher)
Example 4: Complex Example
Combining multiple <rb>
, <rt>
, and <rtc>
within a single <ruby>
element for complex annotations.
<ruby>
<rb>ζ₯ζ¬</rb><rt>γ«γ»γ</rt><rtc>Nihon</rtc>
<rb>θͺ</rb><rt>γ</rt><rtc>go</rtc>
</ruby>
This showcases multiple base and ruby annotation to get multiple interpretations along with the containers
Browser Support
Browser | Version |
---|---|
Chrome | All |
Edge | All |
Firefox | All |
Safari | All |
Opera | All |
Notes and Tips
- The
<rtc>
tag must be nested inside a<ruby>
element. - While it's technically allowed to have multiple
<rtc>
tags, the typical use case is to provide alternative annotations for the<rt>
element. - If an
<rt>
element is not present, the rtc tag is invalid. - Use
<rp>
tags with parentheses or similar markers to clarify the ruby text for browsers that donβt support ruby. - The
<rtc>
tag can greatly improve the accessibility of content that relies on ruby annotations. - Avoid excessive ruby annotations to maintain readability. Use them only when the additional information is critical.
<rtc>
helps with internationalization by providing translation hints alongside native characters.- Correctly use of these tags helps to improve SEO for content that includes East Asian languages.