1. タイポグラフィー
  2. text-underline-offset

タイポグラフィー

text-underline-offset

テキストの下線のオフセットを制御するためのユーティリティ。

クラススタイル
underline-offset-<number>
text-underline-offset: <number>px;
-underline-offset-<number>
text-underline-offset: calc(<number>px * -1);
underline-offset-auto
text-underline-offset: auto;
underline-offset-(<custom-property>)
text-underline-offset: var(<custom-property>);
underline-offset-[<value>]
text-underline-offset: <value>;

基本的な例

underline-offset-<number> などの underline-offset-2underline-offset-4 ユーティリティを使用して、テキストの下線のオフセットを変更します

underline-offset-1

The quick brown fox jumps over the lazy dog.

underline-offset-2

The quick brown fox jumps over the lazy dog.

underline-offset-4

The quick brown fox jumps over the lazy dog.

underline-offset-8

The quick brown fox jumps over the lazy dog.

<p class="underline underline-offset-1">The quick brown fox...</p>
<p class="underline underline-offset-2">The quick brown fox...</p>
<p class="underline underline-offset-4">The quick brown fox...</p>
<p class="underline underline-offset-8">The quick brown fox...</p>

カスタム値の使用

以下を使用してください underline-offset-[<value>] 構文 を設定するにはテキストの下線のオフセット完全にカスタム値に基づいて

<p class="underline-offset-[3px] ...">
Lorem ipsum dolor sit amet...
</p>

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

<p class="underline-offset-(--my-underline-offset) ...">
Lorem ipsum dolor sit amet...
</p>

これは単なる省略形です underline-offset-[var(<custom-property>)] var() 関数を自動的に追加します。

レスポンシブデザイン

プレフィックスa text-underline-offset ユーティリティ md: のようなブレークポイントバリアントをプレフィックスとして使用して、ユーティリティを適用するのはmedium 画面サイズ以上の場合のみです

<p class="underline md:underline-offset-4 ...">
Lorem ipsum dolor sit amet...
</p>

バリアントドキュメントでバリアントの使用方法の詳細をご覧ください。

Copyright © 2025 Tailwind Labs Inc.·商標ポリシー