Sizing
min-height
Setting the minimum height of an element.
Overview
| Class | Declarations |
|---|---|
min-vh | min-height: 100vh;
|
min-h:full | min-height: 100%;
|
min-h:fit | min-height: fit-content;
|
min-h:min | min-height: min-content;
|
min-h:max | min-height: max-content;
|
min-h:3xs | min-height: var(--container-3xs);
|
min-h:2xs | min-height: var(--container-2xs);
|
min-h:xs | min-height: var(--container-xs);
|
min-h:sm | min-height: var(--container-sm);
|
min-h:md | min-height: var(--container-md);
|
min-h:lg | min-height: var(--container-lg);
|
min-h:xl | min-height: var(--container-xl);
|
min-h:2xl | min-height: var(--container-2xl);
|
min-h:3xl | min-height: var(--container-3xl);
|
min-h:4xl | min-height: var(--container-4xl);
|
min-h:5xl | min-height: var(--container-5xl);
|
min-h:6xl | min-height: var(--container-6xl);
|
min-h:7xl | min-height: var(--container-7xl);
|
min-h:<size> | min-height: <size>;
|
Examples
Set a baseline height
Use min-h:* when content may grow but the region still needs a minimum block size.
<section class="min-h:48x"> ...</section>Generated CSS
@layer utilities { .min-h\:48x { min-height: 12rem }}Build viewport sections
Use native viewport units for full-screen or near full-screen layouts.
<main class="min-h:100dvh"> ...</main>100dvh follows the dynamic viewport size on modern mobile browsers. Use min-vh when the legacy 100vh value is the intended cap.
Let content define the final size
Unlike h:*, a minimum height does not clip or force overflow by itself. It establishes a floor, then lets content expand the element.
<article class="min-h:32x overflow:visible"> ...</article>Apply conditionally
Apply styles based on different states using selectors and conditional queries.
<div class="min-h:32x min-h:100dvh@sm min-h:0@print">...</div>Use height when the element should have an exact height.