<mstyle>
<mstyle> MathML 元素用於更改其子元素的樣式。
注意: 歷史上,此元素幾乎接受所有 MathML 屬性,並用於覆蓋其後代元素的預設屬性值。後來,它被限制為僅允許少數在現有網頁中使用的相關樣式屬性。如今,這些樣式屬性 與所有 MathML 元素通用,因此 <mstyle> 實際上等同於一個 <mrow> 元素。但是,<mstyle> 對於與瀏覽器以外的 MathML 實現的相容性仍然可能很重要。
屬性
此元素的屬性包括 全域性 MathML 屬性以及以下已棄用的屬性
background已棄用 非標準-
請改用 CSS 屬性
background-color。 color已棄用 非標準-
請改用 CSS 屬性
color。 fontsize已棄用 非標準-
請改用 CSS 屬性
font-size。 fontstyle已棄用 非標準-
請改用 CSS 屬性
font-style。 fontweight已棄用 非標準-
請改用 CSS 屬性
font-weight。
示例
對映到 CSS 的屬性
以下示例使用 全域性屬性 displaystyle 和 mathcolor 分別覆蓋 <munder> 和 <munderover> 子元素的 math-style 和 color。
html
<math display="block">
<mstyle displaystyle="false" mathcolor="teal">
<munder>
<mo>∑</mo>
<mi>I</mi>
</munder>
<munderover>
<mo>∏</mo>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>N</mi>
</munderover>
</mstyle>
</math>
舊指令碼屬性
以下示例顯示了一個公式,其 font-size 設定為 128pt。它包含巢狀上標中的數字以及一個具有舊屬性 scriptsizemultiplier 和 scriptminsize 的 <mstyle> 元素。當進入每個上標時,font-size 將乘以 0.5,前提是它不會小於 16pt。
html
<math display="block">
<mstyle scriptsizemultiplier="0.5" scriptminsize="16pt">
<msup>
<mn>2</mn>
<msup>
<mn>2</mn>
<msup>
<mn>2</mn>
<msup>
<mn>2</mn>
<msup>
<mn>2</mn>
<msup>
<mn>2</mn>
<mn>2</mn>
</msup>
</msup>
</msup>
</msup>
</msup>
</msup>
</mstyle>
</math>
css
math {
font-size: 128pt;
}
技術摘要
| 隱式 ARIA 角色 | None |
|---|
規範
| 規範 |
|---|
| MathML Core # style-change-mstyle |
瀏覽器相容性
載入中…