CKTIS / CSS
math-style — kompakter oder normaler mathematischer Satz
Die CSS-Eigenschaft math-style wählt den normalen oder kompakten MathML-Satz aus und beeinflusst die Höhe der Formel, die Abstände und die Größe ihrer Bestandteile.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
math-style: normal | compact;math-style steuert den MathML-Satz: normal fordert keine Minimierung der Höhe an, während compact dies tut. Beim kompakten Satz werden die Abstände bei Brüchen und Wurzeln verringert, große Operatoren nicht vergrößert und bewegliche Grenzen an Positionen seitlicher Indizes verschoben. Die Schriftgrößenskalierung hängt außerdem von font-size: math und math-depth ab.
Die Eigenschaft wird vererbt, hat den Anfangswert normal und gilt für alle Elemente, wirkt sich aber auf den mathematischen Satz aus. Das Browser-Stylesheet setzt für die standardmäßige MathML-Wurzel compact und für Wurzeln mit display="block" den Wert normal. Die Deklaration allein schaltet eine Formel nicht zwischen Inline- und Blocksatz um.
Beispiele
<!doctype html>
<meta charset="utf-8">
<title>math-style</title>
<style>
math { font-size: 32px; }
#normal { math-style: normal; }
#compact { math-style: compact; }
</style>
<p>normal:
<math id="normal"><mfrac><mn>1</mn><mn>2</mn></mfrac></math>
</p>
<p>compact:
<math id="compact"><mfrac><mn>1</mn><mn>2</mn></mfrac></math>
</p>
<pre id="result"></pre>
<script>
document.getElementById('result').textContent =
['normal', 'compact'].map(id =>
getComputedStyle(document.getElementById(id))
.getPropertyValue('math-style').trim()
).join('\n');
</script>Ergebnis
normal compact
Der angezeigte Code und das angegebene Ergebnis wurden in einer isolierten Umgebung mit der im Prüfnachweis für genau diese Version dokumentierten Methode verifiziert.