此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

displaystyle

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2023年1月⁩.

displaystyle 全局属性是一个用于设置 MathML 元素的 math-style 的布尔值。

示例

在这个示例中,使用 munder 元素将脚本“A”附加到基础的“∑”上。默认情况下,求和符号是以从其父元素继承的字体大小渲染的,并且 A 作为缩小的下标。通过显式设置 displaystyle="true" 属性,求和符号将会变大,并且“A”变成一个下标。

html
<math>
  <munder>
    <mo>∑</mo>
    <mi>A</mi>
  </munder>
  <munder displaystyle="true">
    <mo>∑</mo>
    <mi>A</mi>
  </munder>
</math>

语法

html
<math displaystyle="true"></math>
<math displaystyle="false"></math>

true

将显示样式设置为 normal

false

将显示样式设置为 compact

规范

Specification
MathML Core
# dfn-displaystyle

浏览器兼容性

参见