CKTIS / CSS
CSS property `ruby-overhang`
The inherited `ruby-overhang` property controls whether a wider ruby annotation may overlap neighboring text. `auto` leaves the amount and conditions to the browser, while `spaces` permits overlap only over adjacent spacing.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
auto | spacesThe inherited ruby-overhang property controls whether a wider ruby annotation may overlap neighboring text. auto leaves the amount and conditions to the browser, while spaces permits overlap only over adjacent spacing.
The example applies spaces to an annotation wider than its base and surrounds it with ideographic spaces. The 150-pixel red test width exactly matches the blue reference layout, showing that spacing is consumed without extending beyond it.
Grammar: auto | spaces.
The auto value may overhang but is not required to, so authors cannot assume a fixed distance. Legacy none aliases spaces, and full-width punctuation exposes only specified fractions of space. The CSS Ruby Editor’s Draft still evolves, so check @supports.
Examples
<!doctype html><html lang="ja"><meta charset="utf-8"><style>html,body{margin:0;background:white;font-family:monospace}div{font-size:20px;border-left:5px solid;border-right:5px solid;width:max-content}.test{border-color:red}.measure{border-color:blue}ruby{ruby-overhang:spaces;ruby-align:center}</style><div id="test" class="test">あ <ruby id="ruby">あ<rt>ああああああああああ</rt></ruby> あ</div><div id="measure" class="measure">あ あ あ</div><pre id="result"></pre><script>const f=e=>Math.round(e.getBoundingClientRect().width),v=getComputedStyle(ruby).rubyOverhang;if(v!=='spaces'||f(test)!==150||f(measure)!==150)throw new Error('overhang mismatch '+[v,f(test),f(measure)]);result.textContent='computed='+v+'; widths='+f(test)+'/'+f(measure);</script></html>Result
computed=spaces; widths=150/150
The example applies `spaces` to an annotation wider than its base and surrounds it with ideographic spaces. The 150-pixel red test width exactly matches the blue reference layout, showing that spacing is consumed without extending beyond it.