CSS ruby-align Property
Description
The ruby-align property controls how ruby annotations (the small text usually used for pronunciation or other annotations above or beside base text) are positioned relative to their base text and to each other within the ruby container. It determines the distribution and anchoring of the annotation boxes when a ruby base has one or more annotation segments; in practice this affects whether annotations are grouped, centered, stretched, or spaced across the extent of their associated base text. This is important when annotations do not naturally match the width of the base text or when multiple annotation runs must share a single base segment.
Because ruby annotations can be rendered in different orientations and alongside different layout constraints, ruby-align interacts with other layout properties. It complements the placement decision made by ruby-position, which determines whether the annotations appear above, below, or beside the base text; while ruby-position picks the side, ruby-align chooses how annotation boxes are arranged along the axis of the ruby container. The effective alignment is also influenced by the page’s writing direction and flow, so authors should consider the document’s writing-mode when reasoning about how annotations will be distributed in horizontal versus vertical text.
In practical terms, ruby-align matters whenever you want predictable spacing or grouping of ruby text — for example, aligning multiple short annotations evenly across a wider base or preventing long annotations from pushing others out of alignment. It also interacts with inline-level alignment behaviors such as text-align because the positioning of the ruby container relative to surrounding inline content can affect available space and line-breaking; authors often use these properties together to achieve consistent visual results. Finally, because ruby layout can produce complex inline boxes (anonymous wrappers, stacked annotation levels), understanding how ruby-align redistributes annotation boxes helps avoid unexpected overlaps or uneven spacing in dense annotated text.
Definition
- Initial value
- auto
- Applies to
- All elements and generated content
- Inherited
- Yes
- Computed value
- Specified value (except for initial and inherit)
- Animatable
- No
- JavaScript syntax
- object.style.rubyAlign
Syntax
ruby-align: start | center | space-between | space-around
Values
- startThe ruby content is aligned with the start edge of its box.
- centerThe ruby content is centered within its box.
- space-betweenThe ruby content expands as defined for normal text justification, except that if there are no expansion opportunities the content is centered.
- space-aroundAs for 'space-between' except that there exists an extra expansion opportunity whose space is distributed half before and half after the ruby content.
Example
Browser Support
The following information will show you the current browser support for the CSS ruby-align property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported in some modern browsers, but not all.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
