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.

HTML rtc Tag: The Ruby Text Container Explained

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.