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

浏览器兼容性

另见