文字の太さを変える

文字の太さを指定する属性です。

セレクタ名{font-weight:値;}

<span ID="セレクタ名">テキスト</span>

bold

太字

100〜900

※1

normal

デフォルト

bolder

一段階太くなる

lighter

一段階細くなる

※1 100.200.300....と900迄の数値を指定する事が出来ます。10の位や1の位は指定は出来ません。数値が大きくなるにしたがって太くなります。ただし、フォントや、ブラウザによって太さの解釈が異なる場合があります。ちなみに400がデフォルトとなります。

例1

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=Shift_JIS">
<title>文字のサイズを指定する</title>
<style type="text/css">
<!--
#b400 {font-weight:400;}
#b600 {font-weight:600;}
#b900 {font-weight:900;}
#bold {font-weight:bold;}
#bolder {font-weight:bolder;}
#lighter {font-weight:lighter;}
-->
</style>

</head>
<body>
<span ID="b400">400</span>
<br>
<span ID="b600">600</span>
<br>
<span ID="b900">900</span>
<br>
<span ID="bold">bold</span>
<br>
<span ID="bolder">bolder</span>
<br>
<span ID="lighter">lighter</span>
</body>
</html>

こうなります