MathML global attributes
Global attributes are attributes common to all MathML elements; they can be used on all elements, though they may have no effect on some elements.
Global attributes may be specified on allMathML elements,even those not specified in the standard. That means that any non-standard elements must still permit these attributes, even though using those elements means that the document is no longer MathML-compliant.
In addition to the basic MathML global attributes, the following global attributes also exist:
- Theevent handler attributes such as
onclick,onfocus, etc. - The
hrefattribute for making MathML element a hyperlink.
In this article
List of global attributes
autofocusA boolean attribute that indicates that the element should be focused on page load.
classA space-separated list of the classes of the element. Classes allow CSS and JavaScript to select and access specific elements via theclass selectors or functions like the method
Document.getElementsByClassName().data-*Forms a class of attributes, called custom data attributes, that allow proprietary information to be exchanged between theMathML and itsDOM representation that may be used by scripts. All such custom data are available via the
MathMLElementinterface of the element the attribute is set on. TheMathMLElement.datasetproperty gives access to them.dirAnenumerated attribute indicating the directionality of the MathML element. It can have the following values:
ltr, which meansleft to right and is used to render mathematical expressions from the left to the right (e.g., English or Moroccan style);rtl, which meansright to left and is used to render mathematical expressions from the right to the left (e.g., Maghreb or Machrek style);
displaystyle:A boolean setting themath-style for the element.
true, which meansnormal.false, which meanscompact.
idDefines a unique identifier (ID) which must be unique in the whole document. Its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with CSS).
mathbackgroundAbackground-color for the element.
mathcolorAcolor for the element.
mathsizeA
<length-percentage>used as afont-size for the element.nonceA cryptographic nonce ("number used once") which can be used byContent Security Policy to determine whether a given fetch will be allowed to proceed.
scriptlevelSpecifies amath-depth for the element. See thescriptlevel page for accepted values and mapping.
styleContainsCSS styling declarations to be applied to the element. Note that it is recommended for styles to be defined in a separate file or files. This attribute and the
<style>element have mainly the purpose of allowing for quick styling, for example for testing purposes.tabindexAn integer attribute indicating if the element can take input focus (isfocusable), if it should participate to sequential keyboard navigation, and if so, at what position. It can take several values:
- anegative value means that the element should be focusable, but should not be reachable via sequential keyboard navigation;
0means that the element should be focusable and reachable via sequential keyboard navigation, but its relative order is defined by the platform convention;- apositive value means that the element should be focusable and reachable via sequential keyboard navigation; the order in which the elements are focused is the increasing value of the
tabindex. If several elements share the same tabindex, their relative order follows their relative positions in the document.
Specifications
| Specification |
|---|
| MathML Core> # dfn-mathbackground> |
| MathML Core> # dfn-mathsize> |
| MathML Core> # dfn-scriptlevel> |
| MathML Core> # dfn-mathcolor> |
| MathML Core> # dfn-displaystyle> |
| MathML Core> # dfn-dir> |
Browser compatibility
See also
Elementinterface that allows querying most global attributes.