scriptlevel

scriptlevel 全域性屬性 設定 MathML 元素的 math-depth。它允許覆蓋來自 使用者代理樣式表 的規則,這些規則定義了 MathML 公式中 font-size 的自動計算。

示例

html
<!-- math-depth defaults to 0 on the <math> root. -->
<math style="font-size: 64pt">
  <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>

語法

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

如果 <U> 是一個無符號 整數(即字首符號已移除),則接受的值為

<U>

math-depth 設定為值 <U>。這會將元素的 font-size 設定為與指定深度處的元素的 font-size 相同的值。

+<U>

math-depth 設定為值 add(<U>)。這會將元素的 font-size 縮小 <U> 倍。

-<U>

math-depth 設定為值 add(-<U>)。這會將元素的 font-size 放大 <U> 倍。

規範

規範
MathML 核心
# dfn-scriptlevel

瀏覽器相容性

BCD 表格僅在啟用 JavaScript 的瀏覽器中載入。

另請參閱