docs.rodeo

MDN Web Docs mirror

scriptlevel

{{MathMLRef}} 

The scriptlevel global attribute sets the math-depth of a MathML element. It allows overriding rules from the user agent stylesheet that define automatic calculation of font-size within MathML formulas.

Example

html,
body {
  height: 100%;
}

body {
  display: grid;
  place-items: center;
}
<!-- math-depth defaults to 0 on the <math> root. -->
<math style="font-size: 24px">
  <msubsup>
    <!-- math-depth and font-size remain unchanged on the base. -->
    <mtext>base</mtext>
    <!-- math-depth defaults to add(1) within the subscript, so it
         is incremented by 1 and the font-size is scaled down once. -->
    <mtext>subscript</mtext>
    <!-- math-depth defaults to add(1) within the superscript too, but
         the scriptlevel attribute tells to increment it by 2 instead,
         so the font-size is actually scaled down twice. -->
    <mtext scriptlevel="+2">superscript</mtext>
  </msubsup>
</math>

Syntax

<math scriptlevel="-1"> <!-- decrease math-depth by 1 -->
<math scriptlevel="+2"> <!-- increase math-depth by 2 -->
<math scriptlevel="0"> <!-- reset math-depth to 0 -->

Values

If <U> is an unsigned integer (i.e. with prefix sign symbol removed) then the accepted values are:

{{EmbedLiveSample("Example", "", 150)}} 

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN