The MathML <mstyle> element is used change the style of its children. It accepts all attributes of all MathML presentation elements with some exceptions and additional attributes listed below.
Attributes
dir- Overall directionality of formulas. Possible values are either
ltr(left to right) orrtl(right to left). decimalpoint- This attribute is specifying the character for the alignment point within
<mstack>and<mtable>columns, if thedecimalpointvalue is used to specify the alignment. displaystyle- A Boolean value specifying whether more vertical space is used for displayed equations or, if set to
false, a more compact layout is used to display formulas. The main effect is that larger versions of operators are displayed, whendisplaystyleis set totrue. See alsolargeopandmovablelimitson<mo>. infixlinebreakstyle- Specifies the default
linebreakstyleto use for infix operators. The valuesbefore,afterandduplicateare allowed. scriptlevel- Controls mostly the font-size. The higher the
scriptlevel, the smaller the font size. This attribute accepts a non-negative integer, as well as a "+" or a "-" sign, which increments or decrements the current value. In addition, thescriptlevelattribute can never reduce the font size belowscriptminsizein order to avoid unreadable small font sizes and depends on the multiplier specified inscriptsizemultiplier. scriptminsize- Specifies a minimum font size allowed due to changes in
scriptlevel. The default value is 8pt. scriptsizemultiplier- Specifies the multiplier to be used to adjust font size due to changes in
scriptlevel. The default value is 0.71.
The <mstyle> element accepts all attributes of all presentation elements with the following exceptions:
height,depthorwidthdo not apply to<mglyph>,<mpadded>or<mtable>.rowalign,columnalign, orgroupaligndo not apply to<mtr>,<mlabeledtr>,<mtd>or<maligngroup>.lspaceorvoffsetdo not apply to<mpadded>.fontfamilydoes not apply to<mglyph>.aligndoes not apply to<mtable>or<mstack>.indexcannot be set on<mstyle>.srcandalton<mglyph>cannot be set on<mstyle>.actiontypeon<maction>cannot be set on<mstyle>.
Examples
Using displaystyle and mathcolor to effect style changes in the layout of the whole sum.
<math>
<mstyle displaystyle="true" mathcolor="teal">
<mrow>
<munderover>
<mo stretchy="true" form="prefix">∑</mo>
<mrow>
<mi>i</mi>
<mo form="infix">=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</munderover>
<mstyle displaystyle="true">
<mfrac>
<mn>1</mn>
<mi>n</mi>
</mfrac>
</mstyle>
</mrow>
</mstyle>
</math>
Specifications
| Specification | Status | Comment |
|---|---|---|
| MathML 3.0 The definition of 'mstyle' in that specification. |
Recommendation | Current specification |
| MathML 2.0 The definition of 'mstyle' in that specification. |
Recommendation | Initial specification |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
mstyle | Chrome No support No | Edge No support No | Firefox Full support 1 | IE No support No | Opera No support No | Safari Full support 5.1 | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 4 | Opera Android No support No | Safari iOS Full support 5.1 | Samsung Internet Android No support No |
decimalpoint | Chrome No support No | Edge No support No | Firefox No support No | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
dir | Chrome No support No | Edge No support No | Firefox Full support 12 | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 14 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
displaystyle | Chrome No support No | Edge No support No | Firefox Full support 1 | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 4 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
infixbreakstyle | Chrome No support No | Edge No support No | Firefox No support No | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
scriptlevel | Chrome No support No | Edge No support No | Firefox Full support 1 | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 4 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
scriptminsize | Chrome No support No | Edge No support No | Firefox Full support 1 | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 4 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
scriptsizemultiplier | Chrome No support No | Edge No support No | Firefox Full support 1 | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 4 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
Legend
- Full support
- Full support
- No support
- No support
Gecko-specific notes
- Prior to Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) the implementation of
<mstyle>was not complete and has been corrected. In particular, setting these attributes onmstylehad no effect to its children:- The
bevelledattribute on<mfrac>elements. - The
notationattribute on<menclose>elements. - The
open,closeandseparatorsattributes on<mfenced>elements. - The
accentandaccentunderattributes on<mover>,<munder>and<munderover>elements. - The
selectionattribute on<maction>elements. - The
mathvariantattribute on<mi>elements.
- The
- Starting with Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26), the attributes accepted on the
<mstyle>element have been restricted to those actually used in practice:id, class, style, href, mathcolor, mathbackground, scriptlevel, displaystyle, scriptsizemultiplier, scriptminsize, dir, mathsize, mathvariant, fontfamily, fontweight, fontstyle, fontsize, color, background.
