HTML5 MathML

HTML5 MathML Attributes

MathML elements accept attributes that control layout, style and behaviour - from the display mode of the <math> root to the thickness of a fraction bar. This overview lists the most common attributes and where they apply.


How MathML attributes work

Each MathML element supports its own set of attributes. Some, like id and class, are global and apply to any element. Others are specific, such as linethickness on <mfrac> or notation on <menclose>. Values are often lengths (px, em), keywords (true, false), or named styles.

Common MathML Attributes

AttributeApplies toDescription
display<math>Renders the formula inline or as a centred block.
mathvarianttoken elementsSets the font style (bold, italic, double-struck).
mathsizetoken elementsSets the font size of the content.
mathcolormost elementsSets the foreground (text) colour.
mathbackgroundmost elementsSets the background colour.
linethickness<mfrac>Sets the thickness of the fraction bar.
notation<menclose>Chooses the enclosing notation (box, circle, strike).
stretchy<mo>Allows an operator to stretch to fit its content.
accent<mover>, <munder>Renders the script tightly as a diacritic accent.
open / close<mfenced>Sets the opening and closing fence characters.
separators<mfenced>Characters placed between children.
actiontype<maction>Chooses the interactive action type.
💡

Many presentation attributes can also be set with CSS on MathML elements in MathML Core, which is often more maintainable than inline attributes.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships