`<ruby>` HTML ruby annotation element
The <ruby> HTML element represents small annotations that are rendered above, below, or next to base text, usually used for showing the pronunciation of East Asian characters. It can also be used for annotating other kinds of text, but this usage is less common.
The **`<ruby>`** [HTML](/docs/Web/HTML) element represents small annotations that are rendered above, below, or next to base text, usually used for showing the pronunciation of East Asian characters. It can also be used for annotating other kinds of text, but this usage is less common.
The term _ruby_ originated as [a unit of measurement used by typesetters](<https://en.wikipedia.org/wiki/Agate_(typography)>), representing the smallest size that text can be printed on newsprint while remaining legible.
tabbed-shorter
```html interactive-example
<ruby> 明日 <rp>(</rp><rt>Ashita</rt><rp>)</rp> </ruby>
```
```css interactive-example
ruby {
font-size: 2em;
}
```
## Attributes
This element only includes the [global attributes](/docs/Web/HTML/Reference/Global_attributes).
## Examples
### Example 1: Character
```html
<ruby>
漢 <rp>(</rp><rt>Kan</rt><rp>)</rp> 字 <rp>(</rp><rt>ji</rt><rp>)</rp>
</ruby>
```
#### Result
Example 1: Character
### Example 2: Word
```html
<ruby> 明日 <rp>(</rp><rt>Ashita</rt><rp>)</rp> </ruby>
```
#### Result
example_2_word
## Technical summary
<table class="properties">
<tbody>
<tr>
<th scope="row">
<a href="/en-US/docs/Web/HTML/Guides/Content_categories"
>Content categories</a
>
</th>
<td>
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#flow_content"
>Flow content</a
>,
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content"
>phrasing content</a
>, palpable content.
</td>
</tr>
<tr>
<th scope="row">Permitted content</th>
<td>
One or more groups, each consisting of two parts:
<ol>
<li>The base text, which is either:
<ul>
<li><a href="/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content">Phrasing content</a>, but with no <code><ruby></code> elements and with no <code><ruby></code> element descendants, or</li>
<li>A single <code><ruby></code> element that itself has no <code><ruby></code> element descendants.</li>
</ul>
</li>
<li>The annotations for the base text, which is either:
<ul>
<li>One or more rt elements, or</li>
<li>An rp element followed by one or more rt elements, each of which is itself followed by an rp element (that is, <code>rp, rt, rp, rt, ..., rp</code>).</li>
</ul>
</li>
</ol>
</td>
</tr>
<tr>
<th scope="row">Tag omission</th>
<td>None, both the starting and ending tag are mandatory.</td>
</tr>
<tr>
<th scope="row">Permitted parents</th>
<td>
Any element that accepts
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content"
>phrasing content</a
>.
</td>
</tr>
<tr>
<th scope="row">Implicit ARIA role</th>
<td>
<a href="https://w3c.github.io/html-aria/#dfn-no-corresponding-role"
>No corresponding role</a
>
</td>
</tr>
<tr>
<th scope="row">Permitted ARIA roles</th>
<td>Any</td>
</tr>
<tr>
<th scope="row">DOM interface</th>
<td>HTMLElement</td>
</tr>
</tbody>
</table>
## Specifications
## Browser compatibility
## See also
- rt
- rp
- ruby-overhang
- text-transform: full-size-kana
- [CSS ruby layout](/docs/Web/CSS/Guides/Ruby_layout) module
Cite this
"` ` HTML ruby annotation element". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ruby JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy