min-height

Sets the minimum height of an element. Guarantees the element is at least the specified height regardless of content. The most common use is minh100vh to ensure full page height.

Classes with Units

Various units can be used with the minh{value}{unit} pattern.

ClassCSSDescription
minh100pxmin-height: 100pxminimum 100px
minh200pxmin-height: 200pxminimum 200px
minh50remmin-height: 50remminimum 500px (50rem)
minh100vhmin-height: 100vhminimum full viewport height
minh50vhmin-height: 50vhminimum half viewport height
minh100pmin-height: 100%at least 100% of parent height

Keyword Classes

ClassCSSDescription
minhamin-height: autobrowser default
minhnmin-height: noneno minimum height limit
minhfcmin-height: fit-contentfit to content
minhmincmin-height: min-contentcontent minimum size
minhmaxcmin-height: max-contentcontent maximum size

Visual Comparison

When content is minimal, min-height guarantees a minimum height.

No min-height

Short content

Shrinks to fit content size

minh20rem — minh20rem

Short content

Guarantees at least 200px height even with little content

Usage Examples

<!-- Full viewport page (footer fixed at bottom) -->
<div class="minh100vh dg gtrauto-1fr-auto">
  <header>Header</header>
  <main>Footer stays at bottom even with little content</main>
  <footer>Footer</footer>
</div>

<!-- Hero section minimum height -->
<section class="minh50vh df jcc aic bg18181B">
  <h1 class="cFAFAFA fs4rem">Hero Title</h1>
</section>

<!-- Card minimum height guaranteed -->
<div class="dg gtcr3-1fr gap2rem">
  <div class="minh20rem bg18181B p2rem br8px">Card 1</div>
  <div class="minh20rem bg18181B p2rem br8px">Card 2</div>
  <div class="minh20rem bg18181B p2rem br8px">Card 3</div>
</div>

Tips

Pinning footer to the bottom

Apply minh100vh to the body or main wrapper and combine with dg gtrauto-1fr-auto to keep the footer at the bottom of the screen even with minimal content.