CKTIS / CSS
Właściwość CSS `math-shift`
`math-shift` wybiera normalne albo zwarte przesunięcie indeksów MathML.
Wersja: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Składnia
normal | compactmath-shift wybiera normalne albo zwarte przesunięcie indeksów MathML.
Przykład porównuje położenie indeksu górnego w obu trybach i raportuje wartość obliczoną na elemencie msup.
Akceptowana gramatyka to normal | compact; wartości globalne nadal podlegają kaskadzie.
Różnica zależy od stałych matematycznych fontu; przeglądarka może zwrócić tę samą geometrię, mimo że wartość obliczona jest compact.
Przykłady
<!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>Wynik
script-y=-2->-2; computed=compact
Przykład uruchomiono lokalnie w izolowanej, bezsieciowej sesji Chrome; wynik pochodzi z API CSS przeglądarki.