【发布时间】:2013-07-11 15:50:19
【问题描述】:
由于可以指定衬里和老式数字,我希望浏览器支持带有 webfonts 的 tabular 数字?##
- 左:默认数字
- 右:所需的表格数字(注意等宽)
相关:Is there a way to specify the use of text or titling figures in CSS?
【问题讨论】:
标签: css typography fixed-width monospace
由于可以指定衬里和老式数字,我希望浏览器支持带有 webfonts 的 tabular 数字?##
相关:Is there a way to specify the use of text or titling figures in CSS?
【问题讨论】:
标签: css typography fixed-width monospace
简单地说,是的。
目前您可以在其前缀形式中使用属性“font-feature-settings”并将 “tnum” 添加到值列表 (example) 以访问启用 OpenType 字体的表格数字: p>
font-feature-settings: 'tnum';
-webkit-font-feature-settings: 'tnum';
-moz-font-feature-settings: 'tnum';
检查caniuse 以查看是否仍需要前缀版本。
注意,如果您使用 Typekit 来提供网络字体,请确保在语言支持下选择“所有字符”。
【讨论】:
虽然可以指定表格数字,但不能保证最终用户的浏览器支持tnum 属性。
State of Web Type 跟踪哪些浏览器支持这些(和其他)高级印刷功能。
在撰写本文时 tnum 支持:
tnum 不支持:
【讨论】:
我认为这是 recommended way 来访问此 OpenType 功能(Mark Fox 的回答中的 font-feature-settings: 'tnum'):
font-variant-numeric: tabular-nums;
我在 http://caniuse.com/#search=font-variant-numeric 上找不到任何东西,所以请坚持使用 Mark 的回答,直到可以更好地确定浏览器支持。
【讨论】: