<rb>: The Ruby Base element

翻译不完整。 请帮助我们翻译这篇文章!

HTML Ruby Base<rb>)元素用于分隔<ruby>注释的基本文本组件(即正在注释的文本)。一个<rb>元素应该包装基本文本的每个单独的原子段。

内容范畴
允许内容 作为 <ruby> 元素的子元素。
标签省略 如果元素紧跟<rt><rtc><rp>元素或其他元素,则可省略结束标记 <rb>元素,或者如果父元素中没有其他内容。
允许的父元素 <ruby>元素。
允许的 ARIA 角色 任意
DOM 接口 HTMLElement

属性

这个元素仅仅支持 全局属性

用法注解

  • Ruby 注解用于展示东亚文字的发音,例如使用日语罗马音和汉语拼音的文字。 <rb> 元素用于分隔出ruby基本文本的每个片段。
  • 虽然 <rb> 不是一个空元素,但是在源码中通常只包括每个元素的开始标签。 因此ruby标记就不那么复杂,也更容易阅读。在渲染版本中,浏览器也可以填充完整的元素。
  • 你需要为要注释的每个基本段(<rb>元素)包含一个<rt>元素。

示例

在此示例中,我们提供了与“hanzi”等效的原始字符的注释:

<ruby>
  <rb>漢</rb>字
  <rp>(</rp><rt>han</rt>zi<rp>)</rp>
</ruby>

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

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

<ruby>
  漢 <rp>(</rp><rt>han</rt><rp>)</rp>
  字 <rp>(</rp><rt>zi</rt><rp>)</rp>
</ruby>

输出看起来像这样:

当在不支持ruby的浏览器中呈现时,上面的HTML可能看起来像这样:

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

规范

Specification Status Comment
HTML5
<rb>
Recommendation

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung 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 38IE Full support 5Opera 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 38Opera 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.

另见