CKTIS / CSS
CSS property `math-shift`
`math-shift` selects normal or compact script shifting in MathML.
Version: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Syntax
normal | compactmath-shift selects normal or compact script shifting in MathML.
The example compares superscript position in both modes and reports the computed value on an msup element.
The accepted grammar is normal | compact; global values still participate in the cascade.
The difference depends on the math constants in the font; a browser can return identical geometry while still computing compact.
Examples
<!doctype html>
<html lang="en"><meta charset="utf-8"><title>CKTIS CSS reference example</title>
<body><div class="probe">probe</div><pre id="result"></pre><script>
document.body.innerHTML='<math><msup id="x"><mi id="b">V</mi><mi id="s">x</mi></msup></math><pre id="result"></pre>';const x=document.querySelector("#x"),b=document.querySelector("#b"),s=document.querySelector("#s");x.style.mathStyle="compact";x.style.mathShift="normal";const a=Math.round(s.getBoundingClientRect().top-b.getBoundingClientRect().top);x.style.mathShift="compact";const z=Math.round(s.getBoundingClientRect().top-b.getBoundingClientRect().top);document.querySelector("#result").textContent="script-y="+a+"->"+z+"; computed="+getComputedStyle(x).mathShift;
</script></body></html>Result
script-y=-2->-2; computed=compact
The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.