Typography on international and multi-lingual web platforms requires sophisticated layout controls to render non-Latin phonetic annotations correctly. In Japanese, Chinese, and East Asian scripts, small phonetic pronunciation guides (Furigana or Bopomofo) are positioned alongside base kanji or hanzi characters using HTML <ruby>, <rb>, and <rt> elements. When phonetic annotation strings are significantly wider than their base characters, the annotation can either expand the base text width awkwardly or overhang adjacent characters. The ruby-overhang CSS property governs this behaviour. Using Apple Safari Web Inspector on macOS, developers can test, inspect, and fine-tune ruby typography directly in WebKit.
Role of ruby-overhang in East Asian Typography
The ruby-overhang property (defined in the CSS Ruby Layout Module) controls whether a ruby text annotation (<rt>) is permitted to extend into the space above adjacent non-ruby characters or neighboring punctuation marks when the annotation text exceeds the width of its base character (<rb>):
auto: Allows the ruby text to overhang adjacent base characters if doing so maintains natural typographic spacing without causing collisions with adjacent ruby annotations. This is the traditional typographic preference in printed Japanese literature.none: Prohibits overhang entirely. If the ruby text is wider than the base character, the layout engine introduces additional horizontal whitespace around the base character, ensuring that adjacent text is pushed away.
Controlling ruby-overhang correctly prevents awkward inter-character gaps in running text paragraphs while ensuring annotations remain legible across responsive layout widths.
Opening Safari Web Inspector to Target Ruby Markup
To inspect ruby elements in Safari:
- Launch Safari on macOS and confirm developer tools are enabled under Settings > Advanced > Show features for web developers.
- Navigate to the webpage displaying Japanese, Chinese, or multi-lingual ruby annotations.
- Right-click the ruby-annotated word or sentence and select Inspect Element.
- In the Elements DOM tree pane, navigate into the
<ruby>container and highlight the child<rt>or parent<ruby>element.
Testing and Modifying ruby-overhang in the Styles Pane
With the ruby node selected, inspect and adjust styling rules in the Styles panel on the right:
- Locate the active rule block or declare the property directly on the element:
ruby { ruby-position: over; ruby-align: space-around; ruby-overhang: auto; } - Double-click the value assigned to
ruby-overhangand switch betweenautoandnone. - Observe the rendered paragraph text on the canvas. When toggled to
none, notice how WebKit forces additional spacing around short base kanji characters to accommodate long furigana annotations. - When set back to
auto, observe how the annotation smoothly overlaps the margins of adjacent kana or punctuation characters, preserving a compact, natural Japanese text flow.
Interactions with ruby-align and ruby-position
In WebKit, ruby-overhang operates in conjunction with companion CSS ruby properties:
1. Interaction with ruby-align
When ruby-align is configured as center, space-between, or space-around, ruby-overhang: auto permits excess annotation widths to distribute evenly past both left and right base margins, provided no adjacent annotation collision occurs.
2. Interaction with ruby-position
Whether annotations are rendered above the base text (ruby-position: over) or beneath it (ruby-position: under), WebKit applies overhang calculations consistently along horizontal inline axes.
3. Vertical Writing Modes
In traditional vertical layouts (writing-mode: vertical-rl), ruby annotations appear to the right of vertical characters. Safari Web Inspector verifies that ruby-overhang dynamically re-orients overhang clearances along the vertical line progression.