<a>

The <a> MathML element creates a hyperlink to other web pages, files, locations within the same page, email addresses, or any other URL. It is very similar to HTML's <a> element.

MathML's <a> element is a container, which means you can create a link around any MathML content. For layout purposes, it behaves like an <mrow> element.

Note: Setting the href attribute on MathML elements other than <a> is deprecated. Use the <a> element to create hyperlinks within MathML content instead.

Attributes

This element accepts the global MathML attributes, as well as the following attribute:

href

The URL that the hyperlink points to. Links are not restricted to HTTP-based URLs — they can use any URL scheme supported by browsers.

Examples

The following example links the formula for mass-energy equivalence to its Wikipedia article.

html
<math display="block">
  <a 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>
  </a>
</math>

Warning: Because this element shares its tag name with HTML's <a> element (and SVG's <a> element), selecting a with CSS or querySelector may apply to the wrong kind of element. Use the @namespace rule to distinguish them.

DOM interface

When implemented, this element will be exposed via the MathMLAnchorElement interface defined in the MathML Core specification. At the time of writing, no browser exposes this interface yet, and the element is accessed through the base MathMLElement interface.

Specifications

Specification
MathML Core
# semantics-and-presentation

Browser compatibility

See also

  • HTML <a> element
  • SVG <a> element
  • href deprecated MathML global attribute