font-synthesis-weight
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2023年3月.
font-synthesis-weight は CSS のプロパティで、フォントファミリーに太字書体がない場合に、ブラウザーが合成するかどうかを指定します。
すべての書体合成値を制御するために、多くの場合は一括指定プロパティ font-synthesis を使用した方が便利です。
構文
css
/* キーワード値 */ font-synthesis-weight: auto; font-synthesis-weight: none; /* グローバル値 */ font-synthesis-weight: inherit; font-synthesis-weight: initial; font-synthesis-weight: revert; font-synthesis-weight: revert-layer; font-synthesis-weight: unset; 値
公式定義
| 初期値 | auto |
|---|---|
| 適用対象 | すべての要素とテキスト。 ::first-letterおよび::first-line にも適用されます。 |
| 継承 | あり |
| 計算値 | 指定通り |
| アニメーションの種類 | 離散値 |
形式文法
font-synthesis-weight =
auto |
none
例
>太字書体の合成の無効化
この例は、 Montserrat フォントでブラウザーによる太字書体の合成をオフにすることを示しています。
HTML
html
<p class="english"> これは既定の <strong>bold typeface</strong> と <em>oblique typeface</em> です。 </p> <p class="english no-syn"> <strong>bold typeface</strong> はオフになりましたが、 <em>oblique typeface</em> はそうではありません。 </p> CSS
css
@import url("https://fonts.googleapis.com/css2?family=Montserrat&display=swap"); .english { font-family: "Montserrat", sans-serif; } .no-syn { font-synthesis-weight: none; } 結果
仕様書
| Specification |
|---|
| CSS Fonts Module Level 4> # font-synthesis-weight> |