Inline
HTML5
The ruby fallback parenthesis element provides fallback parentheses for browsers that don’t support ruby annotations, ensuring readable text in all environments.
Interactive code playground requires JavaScript. Here's the code:
<ruby>
漢 <rp>(</rp><rt>kan</rt><rp>)</rp>
字 <rp>(</rp><rt>ji</rt><rp>)</rp>
</ruby>
base < rp > ( </ rp >< rt > annotation </ rt >< rp > ) </ rp >
The <rp> element wraps parentheses that will only display in browsers without ruby support.
漢 < rp > ( </ rp >< rt > kan </ rt >< rp > ) </ rp >
Displays: 漢 with “kan” above
漢 < rp > ( </ rp >< rt > kan </ rt >< rp > ) </ rp >
Displays: 漢(kan)
The <rp> element ensures graceful degradation:
In modern browsers: parentheses are hidden, ruby displays normally
In older browsers: parentheses display, making annotations readable
Interactive code playground requires JavaScript. Here's the code:
<ruby>
東 <rp>(</rp><rt>とう</rt><rp>)</rp>
京 <rp>(</rp><rt>きょう</rt><rp>)</rp>
</ruby>
Interactive code playground requires JavaScript. Here's the code:
<ruby>
北 <rp>(</rp><rt>běi</rt><rp>)</rp>
京 <rp>(</rp><rt>jīng</rt><rp>)</rp>
</ruby>
Interactive code playground requires JavaScript. Here's the code:
<ruby>
韓 <rp>(</rp><rt>한</rt><rp>)</rp>
國 <rp>(</rp><rt>국</rt><rp>)</rp>
</ruby>
Interactive code playground requires JavaScript. Here's the code:
<ruby>
こんにちは <rp>(</rp><rt>hello</rt><rp>)</rp>
</ruby>
The standard pattern for ruby with fallback:
Interactive code playground requires JavaScript. Here's the code:
<p>
Practice these words:
</p>
<ul>
<li><ruby>私<rp>(</rp><rt>わたし</rt><rp>)</rp></ruby> - I, me</li>
<li><ruby>学生<rp>(</rp><rt>がくせい</rt><rp>)</rp></ruby> - student</li>
<li><ruby>先生<rp>(</rp><rt>せんせい</rt><rp>)</rp></ruby> - teacher</li>
</ul>
Interactive code playground requires JavaScript. Here's the code:
<article>
<p>
The city of
<ruby>
東<rp>(</rp><rt>とう</rt><rp>)</rp>
京<rp>(</rp><rt>きょう</rt><rp>)</rp>
</ruby>
is Japan's capital.
</p>
</article>
Interactive code playground requires JavaScript. Here's the code:
<dl>
<dt><ruby>水<rp>(</rp><rt>みず</rt><rp>)</rp></ruby></dt>
<dd>water</dd>
<dt><ruby>火<rp>(</rp><rt>ひ</rt><rp>)</rp></ruby></dt>
<dd>fire</dd>
<dt><ruby>土<rp>(</rp><rt>つち</rt><rp>)</rp></ruby></dt>
<dd>earth</dd>
</dl>
You can use different parenthesis styles:
Interactive code playground requires JavaScript. Here's the code:
<!-- Square brackets -->
<ruby>
漢 <rp>[</rp><rt>kan</rt><rp>]</rp>
</ruby>
<!-- Curly braces -->
<ruby>
字 <rp>{</rp><rt>ji</rt><rp>}</rp>
</ruby>
<!-- Angle brackets -->
<ruby>
文 <rp>⟨</rp><rt>bun</rt><rp>⟩</rp>
</ruby>
The <rp> element is typically hidden in supporting browsers:
Interactive code playground requires JavaScript. Here's the code:
<style>
/* Modern browsers hide rp by default */
rp {
display: none;
}
/* Custom styling for fallback */
.custom-fallback rp {
color: #999;
font-size: 0.9em;
}
</style>
<div class="custom-fallback">
<ruby>
日<rp>(</rp><rt>に</rt><rp>)</rp>
本<rp>(</rp><rt>ほん</rt><rp>)</rp>
</ruby>
</div>
<!-- Graceful degradation -->
漢 < rp > ( </ rp >< rt > kan </ rt >< rp > ) </ rp >
字 < rp > ( </ rp >< rt > ji </ rt >< rp > ) </ rp >
Works in all browsers with readable fallback.
May be unreadable in browsers without ruby support.
Browser Ruby Support <rp> BehaviorModern Chrome/Firefox/Safari Yes Hidden IE 5.5-10 Partial Visible Very old browsers No Visible
Interactive code playground requires JavaScript. Here's the code:
<article lang="ja">
<h3>Japanese Vocabulary</h3>
<p>
<ruby>
私<rp>(</rp><rt>わたし</rt><rp>)</rp>
</ruby>は
<ruby>
学<rp>(</rp><rt>がく</rt><rp>)</rp>
生<rp>(</rp><rt>せい</rt><rp>)</rp>
</ruby>です。
</p>
<p>(I am a student.)</p>
</article>
Screen readers typically ignore <rp> elements in modern browsers, reading only the base text and ruby annotations.
The fallback parentheses ensure text remains readable even when ruby annotations aren’t visually displayed.
Always use <rp> for maximum compatibility
Use standard parentheses () unless you have a specific reason
Place <rp> correctly - before and after each <rt> element
Test in multiple browsers to ensure fallback works
Browser Version Notes Chrome 5+ Hides <rp> automatically Firefox 38+ Hides <rp> automatically Safari 5+ Hides <rp> automatically Edge 79+ Hides <rp> automatically IE 5.5+ Shows <rp> in fallback mode
All modern browsers properly handle <rp> elements, hiding them when ruby is supported.