HTML5 MathML
HTML5 MathML mathbackground Attribute
The mathbackground attribute sets the background colour behind a MathML element's content. It accepts any CSS colour value.
Definition and usage
The mathbackground attribute fills the background of the element it is applied to. Values can be named colours (yellow), hex codes (#ffff00), or the keyword transparent. It is commonly used to highlight a term or a whole equation.
Which elements use it
- Most MathML presentation elements accept mathbackground, including <math>, <mrow>, <mi>, <mn>, <mo> and <mtd>.
Example
<math>
<mrow>
<mi mathbackground="yellow">x</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</math>The identifier x is drawn on a yellow background, drawing attention to it within the expression.
ℹ️
In MathML Core the equivalent CSS background-color property is preferred and widely supported; the mathbackground attribute still works in browsers that implement it.
