CKTIS / CSS
CSS property `ruby-position`
The inherited `ruby-position` property places an annotation container relative to its base: `over` on line-over, `under` on line-under, `alternate` alternating annotation levels, and `inter-character` between characters.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
[ alternate || [ over | under ] ] | inter-characterThe inherited ruby-position property places an annotation container relative to its base: over on line-over, under on line-under, alternate alternating annotation levels, and inter-character between characters.
The example compares over and under in horizontal text. Chromium places the blue annotations at y=39 and y=60 respectively, while image samples confirm positions above and below the black base.
Grammar: [ alternate || [ over | under ] ] | inter-character.
The sides are logical to writing mode, not always physical top and bottom. In horizontal text, inter-character places the annotation to the right and forces its box to vertical-rl; in vertical text it acts as over. The CSS Ruby Editor’s Draft evolves, so use @supports.
Examples
<!doctype html><meta charset="utf-8"><style>html,body{margin:0;background:white;font-family:monospace}.case{position:absolute;top:40px;font-size:20px;line-height:1}.case rt{font-size:10px;color:blue;background:blue}#over{left:20px;ruby-position:over}#under{left:120px;ruby-position:under}</style><ruby id="over" class="case">A<rt id="ort">WW</rt></ruby><ruby id="under" class="case">A<rt id="urt">WW</rt></ruby><pre id="result"></pre><script>const f=e=>{const r=e.getBoundingClientRect();return [Math.round(r.x),Math.round(r.y),Math.round(r.width),Math.round(r.height)].join(',')},a=getComputedStyle(over).rubyPosition,b=getComputedStyle(under).rubyPosition;if(a!=='over'||b!=='under'||f(ort)!=='20,39,11,12'||f(urt)!=='120,60,11,12')throw new Error('position mismatch');result.textContent='computed='+a+'/'+b+'; rt='+f(ort)+'/'+f(urt);</script>Result
computed=over/under; rt=20,39,11,12/120,60,11,12
The example compares `over` and `under` in horizontal text. Chromium places the blue annotations at y=39 and y=60 respectively, while image samples confirm positions above and below the black base.