非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。

font-smooth CSS property controls the application of anti-aliasing when fonts are rendered.

句法

/* Keyword values */
font-smooth: auto;
font-smooth: never;
font-smooth: always;
/* <length> value */
font-smooth: 2em;
					

WebKit implements a similar property, but with different values: -webkit-font-smoothing . It only works on Mac OS X/macOS.

  • auto - Let the browser decide (Uses subpixel anti-aliasing when available; this is the default)
  • none - Turn font smoothing off; display text with jagged sharp edges.
  • antialiased - Smooth the font on the level of the pixel, as opposed to the subpixel. Switching from subpixel rendering to antialiasing for light text on dark backgrounds makes it look lighter.
  • subpixel-antialiased - On most non-retina displays, this will give the sharpest text.

Firefox implements a similar property, but with different values: -moz-osx-font-smoothing . It only works on Mac OS X/macOS.

  • auto - Allow the browser to select an optimization for font smoothing, typically grayscale .
  • grayscale - Render text with grayscale antialiasing, as opposed to the subpixel. Switching from subpixel rendering to antialiasing for light text on dark backgrounds makes it look lighter.

形式定义

初始值 auto
适用于 所有元素
继承 yes
计算值 如指定
动画类型 discrete

形式句法

auto | never | always | <absolute-size> | <length>

where
<absolute-size> = xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large

范例

Basic usage example

The following example shows the Safari/Chromium and Firefox equivalents that turn on font-smoothing on macOS. In both cases the smoothed font should look slightly lighter in weight.

For those of you not on a macOS system, here is a screenshot (the live version appears later on):

HTML

<p>Without font smoothing</p>
<p class="smoothed">With font smoothing</p>
					

CSS

html {
  background-color: black;
  color: white;
  font-size: 3rem;
}
p {
  text-align: center;
}
.smoothed {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
					

结果

规范

Not part of any standard.

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
font-smooth 非标 Chrome 完整支持 5 Alternate Name
完整支持 5 Alternate Name
Alternate Name Uses the non-standard name: -webkit-font-smoothing
Edge 完整支持 79 Alternate Name
完整支持 79 Alternate Name
Alternate Name Uses the non-standard name: -webkit-font-smoothing
Firefox 完整支持 25 注意事项 Alternate Name
完整支持 25 注意事项 Alternate Name
注意事项 Only works on macOS.
Alternate Name Uses the non-standard name: -moz-osx-font-smoothing
IE 不支持 No Opera 完整支持 15 Alternate Name
完整支持 15 Alternate Name
Alternate Name Uses the non-standard name: -webkit-font-smoothing
Safari 完整支持 4 Alternate Name
完整支持 4 Alternate Name
Alternate Name Uses the non-standard name: -webkit-font-smoothing
WebView Android 完整支持 ≤37 Alternate Name
完整支持 ≤37 Alternate Name
Alternate Name Uses the non-standard name: -webkit-font-smoothing
Chrome Android 完整支持 18 Alternate Name
完整支持 18 Alternate Name
Alternate Name Uses the non-standard name: -webkit-font-smoothing
Firefox Android 不支持 No Opera Android 完整支持 14 Alternate Name
完整支持 14 Alternate Name
Alternate Name Uses the non-standard name: -webkit-font-smoothing
Safari iOS 完整支持 3.2 Alternate Name
完整支持 3.2 Alternate Name
Alternate Name Uses the non-standard name: -webkit-font-smoothing
Samsung Internet Android 完整支持 1.0 Alternate Name
完整支持 1.0 Alternate Name
Alternate Name Uses the non-standard name: -webkit-font-smoothing

图例

完整支持

完整支持

不支持

不支持

非标。预期跨浏览器支持较差。

非标。预期跨浏览器支持较差。

见实现注意事项。

见实现注意事项。

使用非标名称。

使用非标名称。

另请参阅

元数据

  • 最后修改: