scriptlevel

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

scriptlevel 全域性屬性用於設定 MathML 元素的 math-depth。它允許覆蓋 使用者代理樣式表 中定義的 MathML 公式內 字型大小 自動計算規則。

語法

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 設定為與指定深度下元素相同的值。

+<U>

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

-<U>

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

示例

html
<!-- math-depth defaults to 0 on the <math> root. -->
<math>
  <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>

規範

規範
MathML Core
# dfn-scriptlevel

瀏覽器相容性

另見