MathML 属性值

MathML 特定类型

除了 CSS 数据类型外,一些 MathML 属性还接受以下类型:

  • <unsigned-integer>:一个不以 U+002D HYPHEN-MINUS 字符(-)或 U+002B PLUS SIGN(+)开头的 <integer>,例如 1234
  • <boolean>:表示布尔值的字符串 truefalse

旧版 MathML 长度

已弃用: 不再推荐使用该特性。虽然一些浏览器仍然支持它,但也许已从相关的 web 标准中移除,也许正准备移除或出于兼容性而保留。请尽量不要使用该特性,并更新现有的代码;参见本页面底部的兼容性表格以指导你作出决定。请注意,该特性随时可能无法正常工作。

<length-percentage> 之外,MathML 曾经定义了自己的用于描述长度的类型。接受的值包括非零无单位长度值(例如 5 表示 500%)、以点结尾的数字(例如 34.px)或命名空间(例如 thinmathspace)。出于兼容性考虑,建议将非零无单位长度值替换为等效的 <percentage> 值,删除数字中不必要的点,并使用以下替代方案替换具名长度:

veryverythinmathspace  => 0.05555555555555555em
verythinmathspace      => 0.1111111111111111em
thinmathspace          => 0.16666666666666666em
mediummathspace        => 0.2222222222222222em
thickmathspace         => 0.2777777777777778em
verythickmathspace     => 0.3333333333333333em
veryverythickmathspace => 0.3888888888888889em

单位

单位 描述
em Font-relative 单位
ex 与字体相关的单位。(表示元素的 x-高度,在许多字体中大约等于 em 单位的一半。)
px 像素
in 英寸(1 英寸 = 2.54 厘米)
cm 厘米
mm 厘米
pt 点(1 点 = 1/72 英寸)
pc 派卡(1 派卡 = 12 点)
% 默认值的百分比

常数

常数
veryverythinmathspace 1/18em
verythinmathspace 2/18em
thinmathspace 3/18em
mediummathspace 4/18em
thickmathspace 5/18em
verythickmathspace 6/18em
veryverythickmathspace 7/18em
negativeveryverythinmathspace -1/18em
negativeverythinmathspace -2/18em
negativethinmathspace -3/18em
negativemediummathspace -4/18em
negativethickmathspace -5/18em
negativeverythickmathspace -6/18em
negativeveryverythickmathspace -7/18em

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Named spaces (e.g. thinmathspace to mean 3/18em)
Non-standard
Nonzero unitless values (e.g. 5 to mean 500% the default thickness)
Non-standard

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.