font-optical-sizing
CSS
property sets whether text rendering is optimized for viewing at different sizes.
/* keyword values */ font-optical-sizing: none; font-optical-sizing: auto; /* default */ /* Global values */ font-optical-sizing: inherit; font-optical-sizing: initial; font-optical-sizing: unset;
The browser will not modify the shape of glyphs for optimal viewing.
The browser will modify the shape of glyphs for optimal viewing.
Optical sizing is enabled by default for fonts that have an optical size variation axis. The optical size variation axis is represented by
opsz
in
font-variation-settings
.
When optical sizing is used, small text sizes are often rendered with thicker strokes and larger serifs, whereas larger text is often rendered more delicately with more contrast between thicker and thinner strokes.
| 初始值 |
auto
|
|---|---|
| 适用于 |
所有元素。它还适用于
::first-letter
and
::first-line
.
|
| 继承 | yes |
| 计算值 | 如指定 |
| 动画类型 | discrete |
auto | none
<p class="optical-sizing">This paragraph is optically sized. This is the default across browsers.</p> <p class="no-optical-sizing">This paragraph is not optically sized. You should see a difference in supporting browsers.</p>
@font-face {
src: url('AmstelvarAlpha-VF.ttf');
font-family:'Amstelvar';
font-style: normal;
}
p {
font-size: 36px;
font-family: Amstelvar;
}
.no-optical-sizing {
font-optical-sizing: none;
}
注意 : The font referenced above — which includes optical sizing and is freely-licensed — is good for testing. You can download it on GitHub .
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Fonts Module Level 4
The definition of 'font-optical-sizing' in that specification. |
工作草案 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
font-optical-sizing
|
Chrome 完整支持 79 | Edge 完整支持 17 |
Firefox
完整支持
62
|
IE 不支持 No | Opera 完整支持 66 | Safari 完整支持 11 | WebView Android 完整支持 79 | Chrome Android 完整支持 79 |
Firefox Android
完整支持
62
|
Opera Android 不支持 No | Safari iOS 完整支持 11 | Samsung Internet Android 完整支持 12.0 |
完整支持
不支持
用户必须明确启用此特征。
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