Web/HTML/Element/rb

From Get docs

Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.


The HTML Ruby Base (<rb>) 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.

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

Content categories None.
Permitted content As a child of a <ruby> element.
Tag omission The 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 parents A <ruby> element.
Permitted ARIA roles Any
DOM interface HTMLElement

Attributes

This element only includes the global attributes.

Usage notes

  • 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 an empty 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

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

<ruby>
  <rb>漢<rb>字
  <rp>(</rp><rt>kan<rt>ji<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.

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:

<ruby>
  漢 <rp>(</rp><rt>Kan</rt><rp>)</rp>
  字 <rp>(</rp><rt>ji</rt><rp>)</rp>
</ruby>

The output looks like so:

The HTML above might look something like this when rendered by a browser without ruby support:

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


Specifications

Specification Status Comment
HTML5The definition of '<rb>' in that specification. Recommendation

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet

rb

Non-standard'

Chrome Partial support 5

Notes'

Partial support 5

Notes'

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

Edge Partial support 79

Notes'

Partial support 79

Notes'

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

Firefox

Full support 38

IE

Full support 5

Opera Partial support 15

Notes'

Partial support 15

Notes'

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

Safari Partial support 5

Notes'

Partial support 5

Notes'

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

WebView Android Partial support 37

Notes'

Partial support 37

Notes'

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

Chrome Android Partial support 18

Notes'

Partial support 18

Notes'

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

Firefox Android

Full support 38

Opera Android Partial support 14

Notes'

Partial support 14

Notes'

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

Safari iOS Partial support Partial

Notes'

Partial support Partial

Notes'

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

Samsung Internet Android Partial support Partial

Notes'

Partial support Partial

Notes'

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

Legend

Full support  
Full support
Partial support  
Partial support
Non-standard. Expect poor cross-browser support.'
Non-standard. Expect poor cross-browser support.
See implementation notes.'
See implementation notes.


See also