Rb

<rb>: The Ruby Base element #

::: section-content ::: {#sect1 .notecard .deprecated} Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time. :::

The <rb> HTML element is used to delimit the base text component of a <ruby> annotation, i.e. the text that is being annotated. One <rb> element should wrap each separate atomic segment of the base text. :::

Attributes #

::: section-content This element only includes the global attributes. :::

Usage notes #

::: section-content

  • Ruby annotations are for showing pronunciation of East Asian characters, like using Japanese furigana or Taiwanese bopomofo characters. The <rb> element is used to separate out each segment of the ruby base text.
  • Even though <rb> is not a void element, it is common to just include the opening tag of each element in the source code, so that the ruby markup is less complex and easier to read. The browser can then fill in the full element in the rendered version.
  • You need to include one <rt> element for each base segment/<rb> element that you want to annotate. :::

Examples #

Using rb #

::: section-content In this example, we provide an annotation for the original character equivalent of "Kanji":

::: code-example [html]{.language-name}

<ruby>
  <rb>æ¼¢</rb><rb>å­— </rb><rp>(</rp><rt>kan</rt><rt>ji</rt><rp>)</rp>
</ruby>

:::

Note how we've included two <rb> elements, to delimit the two separate parts of the ruby base text. The annotation on the other hand is delimited by two <rt> elements.

Result #

::: {#sect2 .code-example} ::: iframe ::: ::: :::

Separate annotations #

::: section-content Note that we could also write this example with the two base text parts annotated completely separately. In this case we don't need to include <rb> elements:

::: code-example [html]{.language-name}

<ruby>
  æ¼¢ <rp>(</rp><rt>Kan</rt><rp>)</rp> å­— <rp>(</rp><rt>ji</rt><rp>)</rp>
</ruby>

:::

Result #

::: {#sect3 .code-example} ::: iframe ::: :::

See the article about the <ruby> element for further examples. :::

Technical summary #

::: section-content

Content categoriesNone.
Permitted contentAs a child of a <ruby> element.
Tag omissionThe end tag can be omitted if the element is immediately followed by an <rt>, <rtc>, or <rp> element or another <rb> element, or if there is no more content in the parent element.
Permitted parentsA <ruby> element.
Permitted ARIA rolesAny
DOM interfaceHTMLElement
:::

Specifications #

::: _table #

Specification #

HTML Standard
[# rb]{.small}


:::

Browser compatibility #

::: _table #

     Desktop                                                              Mobile                                                    

     Chrome      Edge        Firefox   Internet   Opera       Safari      WebView     Chrome      Firefox   Opera       Safari on   Samsung
                                       Explorer                           Android     Android     for       Android     IOS         Internet
                                                                                                  Android                           

rb 5 79 38 5 15 5 4.4 18 38 14 4.2 1.0

     Blink has   Blink has                        Blink has   Safari has  Blink has   Blink has             Blink has   Safari has  Blink has
     support for support for                      support for support for support for support for           support for support for support for
     parsing the parsing the                      parsing the parsing the parsing the parsing the           parsing the parsing the parsing the
     `rb`        `rb`                             `rb`        `rb`        `rb`        `rb`                  `rb`        `rb`        `rb`
     element,    element,                         element,    element,    element,    element,              element,    element,    element,
     but not for but not for                      but not for but not for but not for but not for           but not for but not for but not for
     rendering   rendering                        rendering   rendering   rendering   rendering             rendering   rendering   rendering
     `rb`        `rb`                             `rb`        `rb`        `rb`        `rb`                  `rb`        `rb`        `rb`
     content as  content as                       content as  content as  content as  content as            content as  content as  content as
     expected.   expected.                        expected.   expected.   expected.   expected.             expected.   expected.   expected.

:::

See also #

::: section-content

::: _attribution © 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/rb{._attribution-link} :::