タイトル: font-weightプロパティで文字の太さを指定する
SEOタイトル: CSS font-weight 完全ガイド(100-900 / normal/bold / Variable Font / @font-face)
この本文には実行可能なタグ等が含まれるため、安全のためHTMLソースとして表示しています。本文データは変更していません。
<table border="1" cellpadding="6" cellspacing="0" style="border-collapse:collapse;background:#fffbea;border:1px solid #f4c430;margin:1em 0;width:100%"><tr><td style="background:#f4c430;color:#000;font-weight:bold;padding:8px">この記事の要点</td></tr><tr><td style="padding:10px"><ul><li><strong><code>font-weight</code></strong> は文字の太さを指定する CSS プロパティ。<strong>100 〜 900</strong> の 9 段階+キーワード</li><li><code>normal</code> = 400、<code>bold</code> = 700。<code>lighter</code> / <code>bolder</code> は親を基準に 1 段階変える</li><li><strong>指定した weight のフォントが存在しないと</strong>ブラウザが近い weight にフォールバック(合成 bold になることも)</li><li><strong>Variable Font</strong> なら <code>font-weight: 350</code> のような<strong>任意の値</strong>が使える(連続的)</li><li><code>@font-face</code> で <code>font-weight: 100 900;</code> と範囲指定するのが Variable Font の正しいロード法</li></ul></td></tr></table>
<h2>基本の指定方法</h2>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-css">/* 数値(推奨) */
p { font-weight: 400; } /* normal */
strong { font-weight: 700; } /* bold */
/* キーワード */
p.light { font-weight: lighter; }
p.thick { font-weight: bolder; }
p.normal { font-weight: normal; }
p.bold { font-weight: bold; }
/* 9 段階 */
.w100 { font-weight: 100; } /* Thin / Hairline */
.w200 { font-weight: 200; } /* Extra Light */
.w300 { font-weight: 300; } /* Light */
.w400 { font-weight: 400; } /* Normal / Regular */
.w500 { font-weight: 500; } /* Medium */
.w600 { font-weight: 600; } /* Semi Bold / Demi Bold */
.w700 { font-weight: 700; } /* Bold */
.w800 { font-weight: 800; } /* Extra Bold */
.w900 { font-weight: 900; } /* Black / Heavy */</code></pre>
<h2>キーワード / 数値の対応</h2>
<table border="1" cellpadding="6" cellspacing="0" style="border-collapse:collapse;width:100%">
<thead><tr style="background:#e3f2fd"><th>数値</th><th>キーワード</th><th>一般名</th></tr></thead>
<tbody>
<tr><td>100</td><td></td><td>Thin, Hairline</td></tr>
<tr><td>200</td><td></td><td>Extra Light, Ultra Light</td></tr>
<tr><td>300</td><td></td><td>Light</td></tr>
<tr><td><strong>400</strong></td><td><code>normal</code></td><td>Regular, Normal, Book</td></tr>
<tr><td>500</td><td></td><td>Medium</td></tr>
<tr><td>600</td><td></td><td>Semi Bold, Demi Bold</td></tr>
<tr><td><strong>700</strong></td><td><code>bold</code></td><td>Bold</td></tr>
<tr><td>800</td><td></td><td>Extra Bold, Ultra Bold</td></tr>
<tr><td>900</td><td></td><td>Black, Heavy</td></tr>
</tbody>
</table>
<h2>lighter / bolder の挙動</h2>
<p>親要素の weight を基準に<strong>1 段階だけ</strong>軽く / 重くします。実際には次の表に従ってジャンプ:</p>
<table border="1" cellpadding="6" cellspacing="0" style="border-collapse:collapse;width:100%">
<thead><tr style="background:#fff3e0"><th>親の weight</th><th><code>bolder</code></th><th><code>lighter</code></th></tr></thead>
<tbody>
<tr><td>1〜99</td><td>400</td><td>100</td></tr>
<tr><td>100〜349</td><td>400</td><td>100</td></tr>
<tr><td>350〜549</td><td>700</td><td>100</td></tr>
<tr><td>550〜749</td><td>900</td><td>400</td></tr>
<tr><td>750〜899</td><td>900</td><td>700</td></tr>
<tr><td>900〜</td><td>900</td><td>700</td></tr>
</tbody>
</table>
<h2>フォールバックと合成 bold</h2>
<p>指定した weight のフォントファイルが無い場合、ブラウザが<strong>最も近い weight</strong> を選びます。さらに「太字版が存在しない」ときは<strong>合成(synthetic) bold</strong>として強制的に線を太らせます:</p>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-css">body {
font-family: 'Noto Sans JP', sans-serif;
font-weight: 400; /* Regular */
}
strong {
font-weight: 800; /* Extra Bold */
/* もし 800 が無ければ 700 にフォールバック */
/* それも無ければブラウザが合成 bold(見た目が荒くなる) */
}
/* 合成を禁止して、本来のフォントウェイトだけ使う */
strong {
font-synthesis: none;
}</code></pre>
<h2>Variable Font を使う</h2>
<p>Variable Font は<strong>1 ファイルで連続的に weight を変えられる</strong>新世代フォント:</p>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-css">/* @font-face で範囲指定 */
@font-face {
font-family: 'Inter';
src: url('/fonts/Inter-VariableFont.woff2') format('woff2-variations');
font-weight: 100 900; /* ★ 100 〜 900 の任意の値が使える */
font-style: normal;
font-display: swap;
}
body {
font-family: 'Inter', sans-serif;
}
p { font-weight: 350; } /* ✅ 連続値が指定可能 */
h1 { font-weight: 875; } /* ✅ */
.subtle { font-weight: 425; } /* ✅ Light と Regular の間 */</code></pre>
<h3>Google Fonts での Variable Font</h3>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-html"><!-- 100-900 全範囲 -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet"></code></pre>
<h2>@font-face で固定 weight をロード</h2>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-css">/* Regular */
@font-face {
font-family: 'NotoSansJP';
src: url('/fonts/NotoSansJP-Regular.woff2') format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
}
/* Bold */
@font-face {
font-family: 'NotoSansJP';
src: url('/fonts/NotoSansJP-Bold.woff2') format('woff2');
font-weight: 700;
font-style: normal;
font-display: swap;
}
/* ★ 同じ font-family で異なる weight ファイルを別個に登録するのが正しい
font-weight: 400 と font-weight: 700 でブラウザが自動で正しい方を使う */</code></pre>
<h2>font-style / font-stretch との組合せ</h2>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-css">/* 短縮形 font */
p {
font: italic bold 16px/1.5 'Noto Sans JP', sans-serif;
/* style weight size/line-height family */
}
/* 個別指定 */
p {
font-style: italic;
font-weight: 700;
font-stretch: 95%; /* Variable Font の幅も連続可 */
font-size: 16px;
line-height: 1.5;
}</code></pre>
<h2>ブラウザのデフォルト weight</h2>
<table border="1" cellpadding="6" cellspacing="0" style="border-collapse:collapse;width:100%">
<thead><tr style="background:#e3f2fd"><th>要素</th><th>デフォルト weight</th></tr></thead>
<tbody>
<tr><td><code>p</code> / <code>span</code> / <code>div</code> / 本文</td><td>normal (400)</td></tr>
<tr><td><code>h1</code> 〜 <code>h6</code></td><td>bold (700)</td></tr>
<tr><td><code>strong</code> / <code>b</code></td><td>bold (700)</td></tr>
<tr><td><code>em</code> / <code>i</code></td><td>normal (400)(斜体だが太さは normal)</td></tr>
<tr><td><code>th</code></td><td>bold (700)</td></tr>
<tr><td><code>button</code></td><td>normal (400)(UA 依存)</td></tr>
</tbody>
</table>
<h2>Web Font のロード戦略</h2>
<p>weight 別に WOFF2 を全部ロードすると<strong>FCP が遅くなる</strong>。よく使う weight だけ初期ロードし、それ以外は遅延:</p>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-html"><!-- 1. 本文に使う Regular だけ preload -->
<link rel="preload"
href="/fonts/NotoSansJP-Regular.woff2"
as="font" type="font/woff2" crossorigin>
<!-- 2. Bold は font-display: swap で順次 -->
<style>
@font-face {
font-family: 'NotoSansJP';
src: url('/fonts/NotoSansJP-Bold.woff2') format('woff2');
font-weight: 700;
font-display: swap; /* ★ 読込中はシステムフォント */
}
</style>
<!-- 3. Variable Font なら 1 ファイルで全範囲 --></code></pre>
<h2>よくある落とし穴</h2>
<ul>
<li><strong>500 / 600 が指定通り出ない</strong> → そのフォントに 500/600 が存在しない(多くの和文フォントは 400/700 のみ)</li>
<li><strong>bolder にしてもほぼ変わらない</strong> → 親が既に 700 だと 900 が無いと変化しない</li>
<li><strong>合成 bold で字形が崩れる</strong> → <code>font-synthesis: none</code> を入れて<strong>本来の weight のみ</strong>使う</li>
<li><strong>Variable Font なのに連続値が効かない</strong> → <code>@font-face</code> の <code>font-weight</code> に範囲 <code>100 900</code> を書き忘れている</li>
</ul>
<h2>FAQ</h2>
<p><strong>Q: 日本語フォントで Variable Font が使える?</strong><br />
A: Noto Sans JP / M PLUS など Google Fonts の主要和文に Variable 版があります。</p>
<p><strong>Q: <code>font-weight: 0</code> や <code>1000</code> は?</strong><br />
A: 仕様外。多くのブラウザは clamp して 100 / 900 として扱います。</p>
<p><strong>Q: 数値とキーワード、どちらが推奨?</strong><br />
A: 数値推奨。デザインシステムで一貫した weight 管理がしやすく、Variable Font とも整合します。</p>