This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The ruby-align CSS property defines the distribution of the different ruby elements over the base.
/* Keyword values */ ruby-align: start; ruby-align: center; ruby-align: space-between; ruby-align: space-around; /* Global values */ ruby-align: inherit; ruby-align: initial; ruby-align: unset;
| Initial value | space-around |
|---|---|
| Applies to | ruby bases, ruby annotations, ruby base containers, ruby annotation containers |
| Inherited | yes |
| Media | visual |
| Computed value | as specified |
| Animation type | discrete |
| Canonical order | the unique non-ambiguous order defined by the formal grammar |
startcenterspace-betweenspace-aroundstart | center | space-between | space-around
This HTML will render differently with each value of ruby-align:
<ruby> <rb>This is a long text to check</rb> <rp>(</rp><rt>short ruby</rt><rp>)</rp> </ruby>
<ruby> <rb>This is a long text to check</rb> <rp>(</rp><rt>short ruby</rt><rp>)</rp> </ruby>
ruby {
ruby-align: start;
} This gives the following result:
<ruby> <rb>This is a long text to check</rb> <rp>(</rp><rt>short ruby</rt><rp>)</rp> </ruby>
ruby {
ruby-align: center;
} This gives the following result:
<ruby> <rb>This is a long text to check</rb> <rp>(</rp><rt>short ruby</rt><rp>)</rp> </ruby>
ruby {
ruby-align: space-between;
} This gives the following result:
<ruby> <rb>This is a long text to check</rb> <rp>(</rp><rt>short ruby</rt><rp>)</rp> </ruby>
ruby {
ruby-align: space-around;
} This gives the following result:
| Specification | Status | Comment |
|---|---|---|
| CSS Ruby Layout Module Level 1 The definition of 'ruby-align' in that specification. | Working Draft | Initial definition |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | No | No
|
38 | No
|
No | No |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | No | ? | ? | 38 | No | No | No |
Microsoft Edge and its predecessor Internet Explorer—versions 9 through 11—implement an early draft of CSS Ruby where the ruby-align property had the values auto, left, center, right, distribute-letter, distribute-space, and line-edge. Here is a table describing approximate equivalency between the Microsoft implementations and the current CSS Ruby, Level 1 specification:
| Edge and IE Syntax | Standard Syntax |
|---|---|
auto |
space-around (default value) for ideographic scripts or center for Latin scripts; to achieve a similar effect, one may use ISO 15924 script codes in conjunction with HTML lang attributes or XML xml:lang attributes and CSS lang pseudo‑class selectors |
left |
start in left‐to‐right scripts |
center |
center without the optional behavior described in CSS Ruby, Level 1, Section 5.2: Line‐Edge Alignment; this is the Firefox behavior |
right |
start in right‐to‐left scripts |
distribute-letter | space-between |
distribute-space |
space-around (default value) |
line-edge |
center with the optional behavior described in CSS Ruby, Level 1, Section 5.2: Line‐Edge Alignment; Firefox does not support a keyword for this behavior; CSS rules targeting individual ruby elements with the center and start keywords based on ruby base text positions and widths may be used instead to achieve similar effects in Firefox
|
<ruby>, <rt>, <rp>, and <rtc>.ruby-position, ruby-merge.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/ruby-align