0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

fontプロパティ指定方法

Posted at

フォントプロパティはフォントに関する一括指定をすることが出来きます。コードの見た目がスッキリするので、積極的に活用したい。

h1 {
  font: normal normal bold 24px/36px "メイリオ", sans-serif;
}

指定順は次の通り。

h1 {
  font: style variant  weight size/line-height family;
}

font-sizefont-familyの値は必須です。それ以外は省略でき、指定しない場合値は各プロパティの初期値が適用されます。

h1 {
   font: 20px Meiryo;/*最低限の記述量*/
}

僕がコーディング中によく使用するプロパティは、font-weightfont-sizeline-heightです。なのでfont-familyの記述が必須なのは使いづらいなと思いました。実務で使うタイミングは最初にbodyタグやh1h2に当てる時くらいかな。

参考

HTML5 & CSS3 リファレンス
fontプロパティの意味と使い方

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?