サイジング
要素の最大高さを設定するためのユーティリティ。
クラス | スタイル |
---|---|
max-h-<number> | max-height: calc(var(--spacing) * <number>); |
max-h-<fraction> | max-height: calc(<fraction> * 100%); |
max-h-none | max-height: none; |
max-h-px | max-height: 1px; |
max-h-full | max-height: 100%; |
max-h-screen | max-height: 100vh; |
max-h-dvh | max-height: 100dvh; |
max-h-dvw | max-height: 100dvw; |
max-h-lvh | max-height: 100lvh; |
max-h-lvw | max-height: 100lvw; |
max-h-svh | max-height: 100svh; |
max-h-svw | max-height: 100svw; |
max-h-min | max-height: min-content; |
max-h-max | max-height: max-content; |
max-h-fit | max-height: fit-content; |
max-h-(<custom-property>) | max-height: var(<custom-property>); |
max-h-[<value>] | max-height: <value>; |
max-h-<number>
ユーティリティ(max-h-24
や max-h-64
など)を使用して、要素をスペーシングスケールに基づいた固定の最大高さに設定します。
<div class="h-96 ..."> <div class="h-full max-h-80 ...">max-h-80</div> <div class="h-full max-h-64 ...">max-h-64</div> <div class="h-full max-h-48 ...">max-h-48</div> <div class="h-full max-h-40 ...">max-h-40</div> <div class="h-full max-h-32 ...">max-h-32</div> <div class="h-full max-h-24 ...">max-h-24</div></div>
max-h-full
または max-h-<fraction>
ユーティリティ(max-h-1/2
や max-h-2/5
など)を使用して、要素にパーセンテージベースの最大高さを与えます。
<div class="h-96 ..."> <div class="h-full max-h-9/10 ...">max-h-9/10</div> <div class="h-full max-h-3/4 ...">max-h-3/4</div> <div class="h-full max-h-1/2 ...">max-h-1/2</div> <div class="h-full max-h-1/4 ...">max-h-1/4</div> <div class="h-full max-h-full ...">max-h-full</div></div>
以下を使用してください max-h-[<value>]
構文 を設定するには最大高さ完全にカスタムの値に基づいています
<div class="max-h-[220px] ..."> <!-- ... --></div>
CSS変数には、以下も使用できます。 max-h-(<custom-property>)
構文
<div class="max-h-(--my-max-height) ..."> <!-- ... --></div>
これは以下の省略形です。 max-h-[var(<custom-property>)]
var()
関数を自動的に追加するものです。
プレフィックスa max-height
ユーティリティ md:
のようなブレークポイントバリアントを付けて、ユーティリティを適用するのはmedium 画面サイズ以上
<div class="h-48 max-h-full md:max-h-screen ..."> <!-- ... --></div>
バリアントの使用方法の詳細については、バリアントのドキュメントをご覧ください。
The max-h-<number>
ユーティリティは、--spacing
テーマ変数によって駆動され、独自のテーマでカスタマイズできます。
@theme { --spacing: 1px; }
スペーシングスケールのカスタマイズの詳細については、テーマ変数のドキュメントをご覧ください。