mathsize

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The mathsize global attribute sets the font-size of a MathML element.

Note: Use CSS for styling MathML whenever possible. The mathsize attribute should only be included for applications that are not CSS-aware and will be overridden by the CSS font-size property, if set.

Example

html
<math display="block">
  <msup mathsize="16px">
    <mi>a</mi>
    <mn>2</mn>
  </msup>
  <mo>+</mo>
  <msup mathsize="24px">
    <mi>b</mi>
    <mn>2</mn>
  </msup>
  <mo>=</mo>
  <msup mathsize="32px">
    <mi>c</mi>
    <mn>2</mn>
  </msup>
</math>

Syntax

html
<!-- <length> values -->
<math mathsize="12px">
<math mathsize="0.8em">

<!-- <percentage> values -->
<math mathsize="80%">

Values

<length>

A positive <length> value. For most font-relative units (such as em and ex), the font size is relative to the parent element's font size.

<percentage>

A positive <percentage> value, relative to the parent element's font size.

Note: Some browsers may also accept legacy MathML lengths.

Specifications

Specification
MathML Core
# dfn-mathsize
  • In MathML 3 and earlier versions, keywords small, normal, and big as well as the MathML3-specific syntax for lengths was supported. Since MathML Core, the syntax matches CSS <length-percentage> values.

  • This attribute was designed for MathML applications that are not CSS-aware. Since MathML Core, the use of equivalent CSS is recommended instead.

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
mathsize
Deprecated
Chrome – Full support
Chrome 109 (Release date: 2023-01-10)
footnote Full support
Edge – Full support
Edge 109 (Release date: 2023-01-12)
footnote Full support
Firefox – Partial support
Firefox 1 – 69 (Release date: 2004-11-09)
footnote Partial support
footnote Attribute only accepted on a few elements, as specified in MathML 3.
Firefox – Full support
Firefox 70 (Release date: 2019-10-22)
footnote
footnote See https://hg.mozilla.org/mozilla-central/rev/3b30c8db537c
Opera – Full support
Opera 95 (Release date: 2023-02-01)
footnote Full support
Safari – Full support
Safari 5 (Release date: 2010-06-07)
footnote
footnote See https://trac.webkit.org/changeset/63079
Chrome Android – Full support
Chrome Android 109 (Release date: 2023-01-10)
footnote Full support
Firefox for Android – Partial support
Firefox for Android 4 – 68 (Release date: 2011-03-29)
footnote Partial support
footnote Attribute only accepted on a few elements, as specified in MathML 3.
Firefox for Android – Full support
Firefox for Android 79 (Release date: 2020-07-28)
footnote
footnote See https://hg.mozilla.org/mozilla-central/rev/3b30c8db537c
Opera Android – Full support
Opera Android 74 (Release date: 2023-03-13)
footnote Full support
Safari on iOS – Full support
Safari on iOS 4.2 (Release date: 2010-11-22)
footnote
footnote See https://trac.webkit.org/changeset/63079
Samsung Internet – Full support
Samsung Internet 21 (Release date: 2023-05-19)
footnote Full support
WebView Android – Full support
WebView Android 109 (Release date: 2023-01-10)
footnote Full support
WebView on iOS – Full support
WebView on iOS 4.2 (Release date: 2010-11-22)
footnote
footnote See https://trac.webkit.org/changeset/63079
Named spaces (e.g. thinmathspace to mean 3/18em)
Deprecated Non-standard
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 1 (Release date: 2004-11-09)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote Full support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
footnote Full support
Nonzero unitless values (e.g. 5 to mean 500%)
Deprecated Non-standard
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – No support
Firefox 1 – 69 (Release date: 2004-11-09)
footnote Removed in 70 and later
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote Full support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android 4 – 68 (Release date: 2011-03-29)
footnote Removed in 79 and later
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
footnote Full support
small, normal, big values
Deprecated Non-standard
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – No support
Firefox 1 – 82 (Release date: 2004-11-09)
footnote Removed in 83 and later
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 5 (Release date: 2010-06-07)
footnote Full support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android 4 – 82 (Release date: 2011-03-29)
footnote Removed in 83 and later
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 4.2 (Release date: 2010-11-22)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 4.2 (Release date: 2010-11-22)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.
See implementation notes.
Has more compatibility info.

See also