<rb>:Ruby 基础元素

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.

<rb> HTML 元素用于分隔 <ruby> 注释的基本文本组件,即正在注释的文本。一个 <rb> 元素应包含基础文本的每个单独的原子段。

¥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

该元素仅包含 全局属性

¥This element only includes the global attributes.

使用说明

¥Usage notes

  • Ruby 注释用于显示东亚字符的发音,例如使用日语注音假名或台湾语注音字符。<rb> 元素用于分隔 ruby 基础文本的每个片段。
  • 尽管 <rb> 不是 void element,但通常只在源代码中包含每个元素的开始标记,以便 ruby 标记不那么复杂且更易于阅读。然后浏览器可以填充渲染版本中的完整元素。
  • 你需要为要注释的每个基本段/<rb> 元素包含一个 <rt> 元素。

示例

¥Examples

使用 rb

¥Using rb

在此示例中,我们为 "汉子" 的原始字符等效项提供注释:

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

html
<ruby>
  <rb></rb><rb></rb><rp>(</rp><rt>kan</rt><rt>ji</rt><rp>)</rp>
</ruby>

请注意我们如何包含两个 <rb> 元素,以分隔 ruby 基础文本的两个独立部分。另一方面,注释由两个 <rt> 元素分隔。

¥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

单独的注释

¥Separate annotations

请注意,我们也可以使用完全单独注释的两个基本文本部分来编写此示例。在这种情况下,我们不需要包含 <rb> 元素:

¥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:

html
<ruby><rp>(</rp><rt>Kan</rt><rp>)</rp><rp>(</rp><rt>ji</rt><rp>)</rp>
</ruby>

结果

¥Result

有关更多示例,请参阅有关 <ruby> 元素的文章。

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

技术总结

¥Technical summary

内容类别 没有任何。
允许的内容 作为 <ruby> 元素的子元素。
标签遗漏 如果元素后面紧跟着 <rt><rtc><rp> 元素或另一个 <rb> 元素,或者如果父元素中没有更多内容,则可以省略结束标记。
允许的父级 <ruby> 元素。
允许的 ARIA 角色 任何
DOM 接口 HTMLElement

规范

Specification
HTML Standard
# rb

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also