<rb>: The Ruby Base element - HTML: HyperText Markup Language 编辑

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.

{{EmbedInteractiveExample("pages/tabbed/rb.html", "tabbed-standard")}}
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

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>
<ruby> <rb>漢<rb>字 <rp>(</rp><rt>kan<rt>ji<rp>)</rp> </ruby>
body {
  font-size: 22px;
}

The output looks like so:

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

漢字 (kan ji)
body {
  font-size: 22px;
}

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

Specifications

SpecificationStatusComment
HTML5
The definition of '<rb>' in that specification.
Recommendation

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:68 次

字数:6540

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文