mathcolor

已弃用:此特性不再推荐。虽然某些浏览器可能仍然支持它,但它可能已经从相关的网络标准中删除,可能正在删除过程中,或者可能仅为兼容性目的而保留。请避免使用它,如果可能,请更新现有代码;请参阅本页底部的兼容性表格以指导您的决策。请注意,此特性可能随时停止工作。

mathcolor 全局属性用于设置 MathML 元素的 颜色

注意: 尽可能使用 CSS 来设置 MathML 的样式。mathcolor 属性仅应包含在对 CSS 不敏感的应用程序中,并且如果设置了 CSS color 属性,它将被 CSS color 属性覆盖。

示例

html
<math display="block">
  <msqrt mathcolor="tomato">
    <mi mathcolor="darkgreen">x</mi>
  </msqrt>
</math>

语法

html
<!-- Keyword values -->
<math mathcolor="currentColor">

<!-- <named-color> values -->
<math mathcolor="red">
<math mathcolor="orange">
<math mathcolor="tan">
<math mathcolor="rebeccapurple">

<!-- <hex-color> values -->
<math mathcolor="#090">
<math mathcolor="#009900">
<math mathcolor="#090a">
<math mathcolor="#009900aa">

<!-- <rgb()> values -->
<math mathcolor="rgb(34, 12, 64, 0.6)">
<math mathcolor="rgb(34 12 64 / 0.6)">
<math mathcolor="rgb(34.6 12 64 / 60%)">

<!-- <hsl()> values -->
<math mathcolor="hsl(30, 100%, 50%, 0.6)">
<math mathcolor="hsl(30 100% 50% / 0.6)">
<math mathcolor="hsl(30.2 100% 50% / 60%)">

<!-- <hwb()> values -->
<math mathcolor="hwb(90 10% 10%)">
<math mathcolor="hwb(90 10% 10% / 0.5)">
<math mathcolor="hwb(90deg 10% 10%)">
<math mathcolor="hwb(1.5708rad 60% 0%)">
<math mathcolor="hwb(.25turn 0% 40% / 50%)">

<color>

设置元素的文本和装饰部分的颜色,包括例如分数线或根号。

规范

规范
MathML Core
# dfn-mathcolor
  • 在 MathML 3 及更早版本中,支持的值集更为有限。自 MathML Core 起,其语法与 CSS <color> 值相匹配。

  • 此属性是为不支持 CSS 的 MathML 应用程序设计的。自 MathML Core 起,建议改用等效的 CSS。

浏览器兼容性

另见