備忘録的プログラミングリファレンス

font プロパティ

 font プロパティは、font-stylefont-variantfont-weightfont-size / line-heightfont-family プロパティを一括指定するプロパティです。

 使用するフォントは font-family で指定できますが、指定フォントが使用できるかはユーザーのブラウザの環境に依存します。ユーザーの OS に指定フォントが入っていないと代替えフォントで表示されます。

font-family 以外はデフォルト値(Exampleを参照
font: normal normal normal medium/normal serif;

 フォントの色指定には color プロパティを使います。

ページ内 Index

構文(Syntax)

CSS

font: font-style font-variant font-weight font-size/line-height font-family | caption | icon | menu | message-box | small-caption | status-bar | initial | inherit ;

DOM ( JavaScript )

値の取得
String = object.style.font;
値の設定
object.style.font=" font-style font-variant font-weight font-size/line-height font-family | caption | icon | menu | message-box | small-caption | status-bar | initial | inherit ";

値(Values)

Value摘要
font-style文字のスタイル
font-variantスモールキャップの有無
font-weight太さ
font-size / line-height大きさ/行間
font-familyフォントファミリ
captionキャプション用システムフォント
iconラベルアイコン用システムフォント
menuメニューに使われるシステムフォント
message-boxダイアログボックス用システムフォント
small-captionキャプションでも小さいシステムフォント
status-barウィンドウのステータスバー用システムフォント
initial初期値に戻す
inherit親エレメントのプロパティを継承

備考(Remarks)

初期値(Default value)normal normal normal medium/normal (ブラウザによる)
継承(Inherited)Yes
CSS AnimationYes

Example

 font の例です。font-family 以外はデフォルト値です。font-family は ”serif” に指定しています。