HTML5 MathML

HTML5 MathML Attribute Complete Reference

This reference lists the attributes you can apply to MathML elements inside the HTML5 <math> root, covering styling, layout, table and interaction attributes.


MathML Attributes

AttributeDescription
displayOn <math>: renders the formula inline or as a centred block.
mathvariantSets the font style of token content (bold, italic, double-struck).
mathsizeSets the font size of the content.
mathcolorSets the foreground (text) colour.
mathbackgroundSets the background colour.
idGlobal unique identifier for CSS, scripting and linking.
classGlobal class name for CSS styling.
styleGlobal inline CSS styling.
dirText direction (ltr or rtl).
linethicknessOn <mfrac>: thickness of the fraction bar.
notationOn <menclose>: the enclosing notation (box, circle, strike).
stretchyOn <mo>: allows the operator to stretch to its content.
symmetricOn <mo>: stretches the operator symmetrically about the axis.
largeopOn <mo>: enlarges the operator in display style.
movablelimitsOn <mo>: moves limits between over/under and sub/sup positions.
separatorOn <mo>: marks the operator as a separator (e.g. a comma).
fenceOn <mo>: marks the operator as a fence (bracket).
lspaceLeading space before an operator or padded content.
rspaceOn <mo>: trailing space after the operator.
accentOn <mover>/<munder>: renders the script as a tight accent.
accentunderOn <munder>/<munderover>: renders the under-script as an accent.
openOn <mfenced>: the opening fence character.
closeOn <mfenced>: the closing fence character.
separatorsOn <mfenced>: characters placed between children.
widthReported width, on <mpadded>, <mspace> and <mglyph>.
heightReported height above the baseline.
depthReported depth below the baseline.
voffsetOn <mpadded>: vertical shift of content.
actiontypeOn <maction>: the interactive action type.
selectionOn <maction>: 1-based index of the displayed child.
frameOn <mtable>: draws a border around the table.
alignOn <mtable>: vertical alignment relative to surroundings.
rowalignVertical alignment of table rows or cells.
columnalignHorizontal alignment of table columns or cells.
rowspacingSpace between table rows.
columnspacingSpace between table columns.
rowlinesLines drawn between table rows.
columnlinesLines drawn between table columns.
scriptsizemultiplierOn <mstyle>: shrink factor per nested script level.
scriptlevelOn <mstyle>: sets the script (size) level for descendants.
mathvariantOverrides the default font style of a token element.
srcOn <mglyph>: the image source for a custom glyph.
altOn <mglyph>: fallback text for a custom glyph.
ℹ️

Attributes marked as belonging to deprecated elements (such as those on <mfenced> or non-Core table attributes) may not work in all browsers; prefer MathML Core features and CSS where possible.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships