font-synthesis-position
Ограниченная доступность
Эта функция не относится к Baseline, так как она не работает в некоторых из самых широко используемых браузеров.
Свойство font-synthesis-position CSS позволяет указать, может ли браузер синтезировать шрифты для подстрочных и надстрочных знаков, если они отсутствуют в наборе шрифтов, используя font-variant-position для установки позиций.
Свойство font-synthesis-position не оказывает влияния при использовании элементов <sup> и <sub>.
Часто удобно использовать сокращенное свойство font-synthesis для управления всеми значениями синтеза шрифтов.
Синтаксис
/* Keyword values */ font-synthesis-position: auto; font-synthesis-position: none; /* Global values */ font-synthesis-position: inherit; font-synthesis-position: initial; font-synthesis-position: revert; font-synthesis-position: revert-layer; font-synthesis-position: unset;
Значения
Формальное определение
| Начальное значение | none |
|---|---|
| Применимо к | всем элементам и тексту. Также применимо к ::first-letter и ::first-line. |
| Наследуется | да |
| Вычисленное значение | как указано |
| Тип анимации | дискретный |
Формальный синтаксис
font-synthesis-position =
auto |
none
Примеры
Отключение синтеза шрифта позиции
Этот пример демонстрирует отключение синтеза шрифтов для надстрочных и подстрочных знаков браузером в шрифте Montserrat.
HTML
<p> These are the default position <span class="super">superscript</span>, position <span class="sub">subscript</span>, <strong>bold</strong> and <em>oblique</em> typefaces. </p> <p class="no-syn"> The positions <span class="super">superscript</span> and <span class="sub">subscript</span> typeface is turned off here but not the <strong>bold</strong> and <em>oblique</em> typefaces (on browsers that support <code>font-synthesis-position</code>). </p>
CSS
@import url("https://fonts.googleapis.com/css2?family=Montserrat&display=swap");
* {
font-family: "Montserrat", sans-serif;
}
.super {
font-variant-position: super;
}
.sub {
font-variant-position: sub;
}
.no-syn {
font-synthesis-position: none;
}
Результат
Спецификации
| Спецификация |
|---|
| CSS Fonts Module Level 4 # font-synthesis-position |
Совместимость с браузерами
| Рабочие столы | Мобильные устройства | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari на IOS | Samsung Internet | WebView Android | |
font-synthesis-position |
Нет | Нет | 118 | Нет | Нет | Нет | 118 | Нет | Нет | Нет | Нет |
auto |
Нет | Нет | 118 | Нет | Нет | Нет | 118 | Нет | Нет | Нет | Нет |
none |
Нет | Нет | 118 | Нет | Нет | Нет | 118 | Нет | Нет | Нет | Нет |
См. также
-
font-synthesisсокращенная запись,font-synthesis-style,font-synthesis-weight -
font-style,font-variant,font-variant-position,font-weight
© 2005–2024 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/font-synthesis-position