href
Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
The href
global attribute creates a hyperlink on the MathML element pointing to the specified URL.
Example
The first equation links to the Wikipedia article about the mass-energy equivalence. The square root part of the second equation is a link to the SageMath calculation.
Note: You should avoid nesting MathML elements with the href
attributes, just like <a>
elements, as is will lead to user confusion and accessibility issues.
<math
display="block"
href="https://en.wikipedia.org/wiki/Mass-energy_equivalence">
<mrow>
<mi>E</mi>
<mo>=</mo>
<mi>m</mi>
<msup>
<mi>c</mi>
<mn>2</mn>
</msup>
</mrow>
</math>
<math display="block">
<mi>c</mi>
<mo>=</mo>
<msqrt href="https://sagecell.sagemath.org/?z=eJwrLiwq0TCOM9I2iTPSBAAeqgPO">
<msup>
<mn>3</mn>
<mn>2</mn>
</msup>
<mo>+</mo>
<msup>
<mn>4</mn>
<mn>2</mn>
</msup>
</msqrt>
<mo>=</mo>
<mn>5</mn>
</math>
Syntax
<math href="https://example.com/">
Values
URL
-
The URL to which the hyperlink points.
Specifications
The href
attribute is not defined in any browser-oriented specification but you can find a description in MathML 4.
Browser compatibility
BCD tables only load in the browser
See also
- All global attributes.