ゼロからはじめるホームページ作成
HOME > スタイルシート講座 > 文字の大きさを設定する

文字の大きさを設定する

font-sizeで文字の大きさを設定することができます。

12ptのように「数字+単位」で設定する方法と、largeなどのキーワードで指定する方法があります。
キーワードにはxx-small、x-small、small、medium、large、x-large、xx-largeの7つがあります。
xx-smallが一番小さく、xx-largeが一番大きい設定です。

「数字+単位」の例

<div style="font-size:10pt">10pt</div>
<div style="font-size:12pt">12pt</div>
<div style="font-size:14pt">14pt</div>
<div style="font-size:10px">10px</div>
<div style="font-size:12px">12px</div>
<div style="font-size:14px">14px</div>

結果

10pt
12pt
14pt
10px
12px
14px

キーワードの例

<div style="font-size:xx-small">xx-small</div>
<div style="font-size:x-small">x-small</div>
<div style="font-size:small">small</div>
<div style="font-size:medium">medium</div>
<div style="font-size:large">large</div>
<div style="font-size:x-large">x-large</div>
<div style="font-size:xx-large">xx-large</div>

結果

xx-small
x-small
small
medium
large
x-large
xx-large

まとめ

  • 文字の大きさはfont-sizeで設定する。
  • 「数字+単位」で設定する方法と、largeなどのキーワードで指定する方法がある。

関連リンク

スポンサードリンク



Copyright© 2006-2008 ゼロからはじめるホームページ作成講座. All Rights Reserved.