Sizing
用於設定元素最小高度的通用類別。
| Class | Styles |
|---|---|
min-h-<number> | min-height: calc(var(--spacing) * <number>); |
min-h-<fraction> | min-height: calc(<fraction> * 100%); |
min-h-px | min-height: 1px; |
min-h-full | min-height: 100%; |
min-h-screen | min-height: 100vh; |
min-h-dvh | min-height: 100dvh; |
min-h-dvw | min-height: 100dvw; |
min-h-lvh | min-height: 100lvh; |
min-h-lvw | min-height: 100lvw; |
min-h-svw | min-height: 100svw; |
min-h-svh | min-height: 100svh; |
min-h-auto | min-height: auto; |
min-h-min | min-height: min-content; |
min-h-max | min-height: max-content; |
min-h-fit | min-height: fit-content; |
min-h-lh | min-height: 1lh; |
min-h-(<custom-property>) | min-height: var(<custom-property>); |
min-h-[<value>] | min-height: <value>; |
使用 min-h-<number> 通用類別(如 min-h-24 和 min-h-64)根據間距比例設定元素為固定最小高度:
<div class="h-20 ..."> <div class="min-h-80 ...">min-h-80</div> <div class="min-h-64 ...">min-h-64</div> <div class="min-h-48 ...">min-h-48</div> <div class="min-h-40 ...">min-h-40</div> <div class="min-h-32 ...">min-h-32</div> <div class="min-h-24 ...">min-h-24</div></div>使用 min-h-full 或 min-h-<fraction> 通用類別(如 min-h-1/2 和 min-h-2/5)為元素設定百分比最小高度:
<div class="min-h-full ...">min-h-full</div><div class="min-h-9/10 ...">min-h-9/10</div><div class="min-h-3/4 ...">min-h-3/4</div><div class="min-h-1/2 ...">min-h-1/2</div><div class="min-h-1/3 ...">min-h-1/3</div>使用 min-h-[<value>] 語法,根據完全自訂的值來設定 minimum height:
<div class="min-h-[220px] ..."> <!-- ... --></div>對於 CSS 變數,你也可以使用 min-h-(<custom-property>) 語法:
<div class="min-h-(--my-min-height) ..."> <!-- ... --></div>這只是 min-h-[var(<custom-property>)] 的簡寫形式,會自動為你加上 var() 函式。
在 min-height 通用類別前面加上像 md: 這樣的中斷點變體,讓該通用類別只在中型螢幕尺寸及以上時套用:
<div class="h-24 min-h-0 md:min-h-full ..."> <!-- ... --></div>在變體文件中了解更多關於使用變體的資訊。
min-h-<number> 通用類別由 --spacing 主題變數驅動,可以在你自己的主題中自訂:
@theme { --spacing: 1px; }在主題變數文件中了解更多關於自訂間距比例的資訊。