math
Native MathML rendering with consistent styling, display/inline modes, numbered equations, and dark mode support.
Overview
The <math> element renders MathML notation natively in the browser. MathML Core is supported in all major engines: Chrome 109+, Firefox, and Safari. No JavaScript or external libraries required.
Vanilla Breeze provides consistent styling across browsers: a math font stack, display and inline modes, numbered equations via CSS counters, and dark mode normalization.
Inline Math
Inline math flows naturally within paragraph text. The element aligns to the text baseline.
The area of a circle is .
Display Math
Use display="block" for centered, standalone equations with vertical margins.
Numbered Equations
Wrap math[display="block"] in a div.equation for auto-incrementing equation numbers. Numbering uses CSS counters, so it works without JavaScript and respects DOM order.
Common Patterns
Fractions
Radicals
Summation
Matrices
Captioned Equations
Use figure.math to wrap an equation with a <figcaption>.
Attributes
| Attribute | Values | Description |
|---|---|---|
display |
"block" |
Renders as centered block equation. Without this attribute, math renders inline. |
This element also supports global attributes.
VB Classes
| Class | Description |
|---|---|
equation |
Wrapper div that adds auto-incrementing equation number via CSS counters. Contains a math[display="block"]. |
Font Loading
MathML rendering quality depends on a math-capable font. Vanilla Breeze defaults to Latin Modern Math, falling back to STIX Two Math and Cambria Math.
For best results, load the math font explicitly:
When using the data-math attribute, the font is loaded automatically when math elements are detected.
Accessibility
- Native MathML is natively understood by screen readers including VoiceOver (Safari) and NVDA with MathPlayer
- No ARIA hacks required — the browser exposes math semantics directly to the accessibility tree
- Use
<semantics>and<annotation>for additional accessible descriptions when needed - Equation numbers assist navigation for sighted and non-sighted users