大网数据广告活动
Web 标准与前端开发

href

· 52CE 我爱测

The **`href`** global attribute creates a hyperlink on a MathML element pointing to the specified URL. Setting `href` on MathML elements other than a is deprecated; you should use the a element to create hyperlinks within MathML content.

The href global attribute creates a hyperlink on a MathML element pointing to the specified URL. Setting href on MathML elements other than a is deprecated; you should use the a element to create hyperlinks within MathML content.

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.

html,
body {
  height: 100%;
}

body {
  display: grid;
  place-items: center;
  font-size: 1.5rem;
}
<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>

Example

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

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。