CKTIS / CSS
CSS свойство `math-shift`
`math-shift` избира нормално или компактно отместване на MathML индекси.
Версия: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Синтаксис
normal | compactmath-shift избира нормално или компактно отместване на MathML индекси.
Примерът сравнява позицията на горния индекс и отчита изчислената стойност върху msup.
Приетата граматика е normal | compact; глобалните стойности остават част от каскадата.
Разликата зависи от математическите константи на шрифта; compact може да даде същата геометрия.
Примери
<!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>Резултат
script-y=-2->-2; computed=compact
Примерът е изпълнен локално в изолирана Chrome сесия без мрежа; резултатът идва от CSS API на браузъра.