

プロパティについて
#
概要
| 初期値 | “font-style: normal;” “font-variant: normal;” “font-weight: normal;” “font-stretch: normal;” “font-size: medium;” “line-height: normal;” (“<'font-family'>”値の初期値はユーザー・エージェントに依る) | 
| 適用対象 | すべての要素 | 
| 継承 | Yes | 
| パーセント値 | 一括指定が対象とする各プロパティの定義に依る | 
| 計算値 | 一括指定が対象とする各プロパティの定義に依る | 
| アニメーション | 一括指定が対象とする各プロパティの定義に依る | 
“font”プロパティは要素のテキストに使用するフォントや文字の大きさ、字体などを指定する以下のプロパティの一括指定プロパティです。
- “font-style”プロパティ
- “font-variant”プロパティ
- “font-weight”プロパティ
- “font-stretch”プロパティ
- “font-size”プロパティ
- “line-height”プロパティ
- “font-family”プロパティ
“font”プロパティは他の一括指定プロパティと同様に省略された値の設定を初期値に戻します。“font”プロパティでは具体的な指定ができないものの、“font”プロパティは以下のプロパティの一括指定プロパティにもなっており、これらのプロパティの指定を初期値に戻します。
- “font-size-adjust”プロパティ
- “font-kerning”プロパティ
- “font-feature-settings”プロパティ
- “font-language-override”プロパティ
- “font-optical-sizing”プロパティ
- “font-variation-settings”プロパティ
- “font-palette”プロパティ
サンプルコード
p { font: bold 1.5em "游明朝","ヒラギノ明朝",serif;}
#
値
フォントの詳細な指定
| 値 | 説明 | 
|---|---|
| <'font-style'> | “font-style”プロパティの値 | 
| <font-variant-css21> | “font-variant”プロパティの値のうちCSS2.1で定義されているもの (“normal”と“small-caps”) | 
| <'font-weight'> | “font-weight”プロパティの値 | 
| <font-stretch-css3>  | “font-stretch”プロパティの値のうち“CSS Fonts level 3”で定義されているもの (“normal”と“ultra-condensed”、“extra-condensed”、“condensed”、“semi-condensed”、“semi-expanded”、“expanded”、“extra-expanded”、“ultra-expanded”) | 
| <'font-size'> | “font-size”プロパティの値 | 
| <'line-height'> | “line-height”プロパティの値 | 
| <'font-family'> | “font-family”プロパティの値 | 
必要な値をホワイトスペースで区切って、複数記述することができます。ただし、値によって記述できる順番が決まっています。
“<'font-style'>”値、“<font-variant-css21>”値、“<'font-weight'>”値、“<font-stretch-css3>”値は任意の順番で1個ずつ指定できます。省略された値は初期値として設定されます。
次に“<'font-size'>”値は必須で1個指定しなければなりません。“<'line-height'>”値を指定する場合は“<'font-size'>”値の後にスラッシュ(“/”)で区切って記述します。“<'line-height'>”値を省略した場合は初期値として設定されます。
“<'font-family'>”値を一番最後に記述します。“<'font-family'>”値の指定は必須です。
最小限の値を記述した場合
div { font: 〚“<'font-size'>”値〛 〚“<'font-family'>”値〛;}
値をすべて記述した場合
div { font: 〚“<'font-style'>”値〛 〚“<font-variant-css21>”値〛 〚“<'font-weight'>”値〛 〚“<font-stretch>”値〛 〚“<'font-size'>”値〛/〚“<'line-height'>”値〛 〚“<box>”値〛 〚“<'font-family'>”値〛;}
キーワード値
| 値 | 説明 | 
|---|---|
| システムフォント | |
| caption | キャプション付きコントロールに使用されるフォント (ボタン、ドロップダウンなど。) | 
| icon | ラベルアイコンに使用されるフォント | 
| menu | メニューに使用されるフォント (ドロップダウンメニュー、メニューリストなど。) | 
| message-box | ダイアログボックスに使用されるフォント | 
| small-caption | 小さいコントロールのラベルに使用されるフォント | 
| status-bar | ウィンドウのステータスバーに使用されるフォント | 
| 他の値 | |
| 共通キーワード | |
システムフォントを指定する場合はいずれかの値を1個だけ指定でき、その値によってフォントや文字の大きさ、字体などが一括で設定されます。“<'font-size'>”値など、他の値との併用はできません。
#
仕様書
定義されている仕様書
|  |  |  |  | |
|---|---|---|---|---|
|   |   |   |   | |
| font |   |   |   |   | 
|  |  |  |  | |
|---|---|---|---|---|
|   |   |   |   | |
| <'font-style'> |   |   |   |   | 
| <font-variant-css21> |   |   |   |   | 
| <'font-weight'> |   |   |   |   | 
| <'font-size'> |   |   |   |   | 
| <'line-height'> |   |   |   |   | 
| <'font-family'> |   |   |   |   | 
| caption |   |   |   |   | 
| icon |   |   |   |   | 
| menu |   |   |   |   | 
| message-box |   |   |   |   | 
| small-caption |   |   |   |   | 
| status-bar |   |   |   |   | 
| <font-stretch> |   |   |   |   | 
使用例
#
#
システムフォントを使用する
.font-caption { font: caption;}
.font-icon { font: icon;}
.font-menu { font: menu;}
.font-message-box { font: message-box;}
.font-small-box { font: small-box;}
.font-status-bar { font: status-bar;}
<p class="font-caption">font: caption;</p>
<p class="font-icon">font: icon;</p>
<p class="font-menu">font: menu;</p>
<p class="font-message-box">font: message-box;</p>
<p class="font-small-caption">font: message-box;</p>
<p class="font-status-bar">font: message-box;</p>
font: caption;
font: small-caption;



 Mar. 4th,2021
Mar. 4th,2021



















