math-style

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since August 2023.

Thuộc tính math-style chỉ ra liệu các phương trình MathML có nên được hiển thị với chiều cao thông thường hay chiều cao thu gọn.

Cú pháp

css
/* Giá trị từ khóa */
math-style: normal;
math-style: compact;

/* Giá trị toàn cục */
math-style: inherit;
math-style: initial;
math-style: revert;
math-style: revert-layer;
math-style: unset;

Giá trị

normal

Giá trị ban đầu, chỉ ra cách hiển thị thông thường.

compact

Bố cục toán học trên các phần tử con cố gắng tối thiểu hóa chiều cao logic.

Định nghĩa hình thức

Initial valuenormal
Applies toall elements
Inheritedyes
Computed valueas specified
Animation typeNot animatable

Cú pháp hình thức

math-style = 
normal |
compact
This syntax reflects the latest standard as per MathML Core. Not all browsers may have implemented every part. See Browser compatibility for support information.

Ví dụ

Thay đổi kiểu của công thức thành compact

CSS

css
math {
  math-style: normal;
}
.compact {
  math-style: compact;
}

HTML

html
<p>
  Normal height
  <math>
    <mrow>
      <munderover>
        <mo>∑</mo>
        <mrow>
          <mi>n</mi>
          <mo>=</mo>
          <mn>1</mn>
        </mrow>
        <mrow>
          <mo>+</mo>
          <mn>∞</mn>
        </mrow>
      </munderover>
    </mrow>
  </math>
  and compact height
  <math class="compact">
    <mrow>
      <munderover>
        <mo>∑</mo>
        <mrow>
          <mi>n</mi>
          <mo>=</mo>
          <mn>1</mn>
        </mrow>
        <mrow>
          <mo>+</mo>
          <mn>∞</mn>
        </mrow>
      </munderover>
    </mrow>
  </math>
  equations.
</p>

Kết quả

Đặc tả kỹ thuật

Specification
MathML Core
# the-math-style-property

Tương thích trình duyệt

Xem thêm