非标
此特征是非标准的,且不在标准轨道中。不要在面向 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
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):
<p>Without font smoothing</p> <p class="smoothed">With font smoothing</p>
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.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
font-smooth
非标
|
Chrome
完整支持
5
Alternate Name
|
Edge
完整支持
79
Alternate Name
|
Firefox
完整支持
25
注意事项
Alternate Name
|
IE 不支持 No |
Opera
完整支持
15
Alternate Name
|
Safari
完整支持
4
Alternate Name
|
WebView Android
完整支持
≤37
Alternate Name
|
Chrome Android
完整支持
18
Alternate Name
|
Firefox Android 不支持 No |
Opera Android
完整支持
14
Alternate Name
|
Safari iOS
完整支持
3.2
Alternate Name
|
Samsung Internet Android
完整支持
1.0
Alternate Name
|
完整支持
不支持
非标。预期跨浏览器支持较差。
见实现注意事项。
使用非标名称。
font
font-family
font-feature-settings
font-kerning
font-language-override
font-optical-sizing
font-size
font-size-adjust
font-smooth
font-stretch
font-style
font-synthesis
font-variant
font-variant-alternates
font-variant-caps
font-variant-east-asian
font-variant-ligatures
font-variant-numeric
font-variant-position
font-variation-settings
font-weight
line-height
line-height-step