タイポグラフィ
要素の white-space プロパティを制御するためのユーティリティです。
whitespace-normal
を使用すると、要素内でテキストが通常どおり折り返されます。改行とスペースは折りたたまれます。
<div class="w-3/4 ...">
<div class="whitespace-normal ...">Hey everyone!
It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien.
You will never know.</div>
</div>
whitespace-nowrap
を使用すると、要素内でテキストが折り返されないようにします。改行とスペースは折りたたまれます。
<div class="w-3/4 overflow-x-auto ...">
<div class="whitespace-nowrap ...">Hey everyone!
It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien.
You will never know.</div>
</div>
whitespace-pre
を使用すると、要素内の改行とスペースが保持されます。テキストは折り返されません。
<div class="w-3/4 overflow-x-auto ...">
<div class="whitespace-pre ...">Hey everyone!
It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien.
You will never know.</div>
</div>
whitespace-pre-line
を使用すると、要素内の改行は保持されますが、スペースは保持されません。テキストは通常どおり折り返されます。
<div class="w-3/4 ...">
<div class="whitespace-pre-line ...">Hey everyone!
It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien.
You will never know.</div>
</div>
whitespace-pre-wrap
を使用すると、要素内の改行とスペースが保持されます。テキストは通常どおり折り返されます。
<div class="w-3/4 ...">
<div class="whitespace-pre-wrap ...">Hey everyone!
It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien.
You will never know.</div>
</div>
whitespace-break-spaces
を使用すると、要素内の改行とスペースが保持されます。行末の空白はぶら下がりませんが、次の行に折り返されます。
<div class="w-3/4 ...">
<div class="whitespace-break-spaces ...">Hey everyone!
It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien.
You will never know.</div>
</div>
Tailwind では、バリアント修飾子を使用して、さまざまな状態でユーティリティクラスを条件付きで適用できます。たとえば、以下を使用します。 ホバー:whitespace-pre
whitespace-pre
ユーティリティのみを以下に適用するにはホバー.
<div class="whitespace-normal hover:whitespace-pre">
<!-- ... -->
</div>
利用可能なすべての状態修飾子の完全なリストについては、 ホバー、フォーカス、その他の状態 のドキュメントを参照してください。
レスポンシブブレークポイント、ダークモード、prefers-reduced-motion などのメディアクエリをターゲットにするために、バリアント修飾子を使用することもできます。たとえば、md:whitespace-pre
を使用すると、whitespace-pre
ユーティリティが中程度の画面サイズ以上でのみ適用されます。
<div class="whitespace-normal md:whitespace-pre">
<!-- ... -->
</div>
詳細については、以下のドキュメントを参照してください。 レスポンシブデザイン, ダークモード および その他のメディアクエリ修飾子.