Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

math-style — compact or normal mathematical layout

The CSS math-style property selects normal or compact MathML layout, affecting formula height, spacing, and the sizes of its parts.

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 controls MathML layout: normal does not request height minimization, whereas compact does. Compact layout uses smaller gaps around fractions and radicals, skips enlargement of large operators, and moves movable limits to side-script positions. Font scaling also depends on font-size: math and math-depth.

The property is inherited, initially normal, and applies to all elements, but affects mathematical layout. The browser stylesheet sets the default MathML root to compact and roots with display="block" to normal. The declaration itself does not switch a formula between inline and block layout.

Examples

<!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>

Result

normal
compact

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources