1. タイポグラフィ
  2. font-stretch

タイポグラフィ

font-stretch

フォントフェイスの幅を選択するためのユーティリティ。

クラススタイル
font-stretch-ultra-condensed
font-stretch: ultra-condensed; /* 50% */
font-stretch-extra-condensed
font-stretch: extra-condensed; /* 62.5% */
font-stretch-condensed
font-stretch: condensed; /* 75% */
font-stretch-semi-condensed
font-stretch: semi-condensed; /* 87.5% */
font-stretch-normal
font-stretch: normal; /* 100% */
font-stretch-semi-expanded
font-stretch: semi-expanded; /* 112.5% */
font-stretch-expanded
font-stretch: expanded; /* 125% */
font-stretch-extra-expanded
font-stretch: extra-expanded; /* 150% */
font-stretch-ultra-expanded
font-stretch: ultra-expanded; /* 200% */
font-stretch-<percentage>
font-stretch: <percentage>;
font-stretch-(<custom-property>)
font-stretch: var(<custom-property>);
font-stretch-[<value>]
font-stretch: <value>;

基本的な例

`font-stretch-condensed` や `font-stretch-expanded` のようなユーティリティを使用して、フォントフェイスの幅を設定します。

font-stretch-extra-condensed

The quick brown fox jumps over the lazy dog.

font-stretch-condensed

The quick brown fox jumps over the lazy dog.

font-stretch-normal

The quick brown fox jumps over the lazy dog.

font-stretch-expanded

The quick brown fox jumps over the lazy dog.

font-stretch-extra-expanded

The quick brown fox jumps over the lazy dog.

<p class="font-stretch-extra-condensed">The quick brown fox...</p>
<p class="font-stretch-condensed">The quick brown fox...</p>
<p class="font-stretch-normal">The quick brown fox...</p>
<p class="font-stretch-expanded">The quick brown fox...</p>
<p class="font-stretch-extra-expanded">The quick brown fox...</p>

これは、複数の幅のバリエーションが利用可能なフォントにのみ適用されます。そうでない場合、ブラウザは最も近い一致を選択します。

パーセンテージの使用

`font-stretch-<percentage>` ユーティリティ(`font-stretch-50%` や `font-stretch-125%` など)を使用して、パーセンテージでフォントフェイスの幅を設定します。

font-stretch-50%

The quick brown fox jumps over the lazy dog.

font-stretch-100%

The quick brown fox jumps over the lazy dog.

font-stretch-150%

The quick brown fox jumps over the lazy dog.

<p class="font-stretch-50%">The quick brown fox...</p>
<p class="font-stretch-100%">The quick brown fox...</p>
<p class="font-stretch-150%">The quick brown fox...</p>

カスタム値の使用

以下を使用してください font-stretch-[<value>] 構文 を設定するにはフォント幅完全にカスタムの値に基づいて

<p class="font-stretch-[66.66%] ...">
Lorem ipsum dolor sit amet...
</p>

CSS変数には、以下も使用できます。 font-stretch-(<custom-property>) 構文

<p class="font-stretch-(--my-font-width) ...">
Lorem ipsum dolor sit amet...
</p>

これは単なる短縮形です font-stretch-[var(<custom-property>)] これは、var() 関数を自動的に追加します。

レスポンシブデザイン

プレフィックスa font-stretch ユーティリティ md: のようなブレークポイントバリアントを使用すると、ユーティリティを適用するのはmedium 画面サイズ以上

<div class="font-stretch-normal md:font-stretch-expanded ...">
<!-- ... -->
</div>

バリアントの使用に関する詳細については、バリアントのドキュメントをご覧ください。

著作権 © 2025 Tailwind Labs Inc.·商標ポリシー