CSS min-height Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The min-height property sets the minimum vertical height of an element. It stops the used height from going smaller than the value you set.

It is not inherited. The initial value is auto. Content can still make the box grow taller. For a writing-mode-aware floor, use min-block-size. Pair with max-height when you also need a cap.

Standard-track.

Not deprecated. Length and percentage values are Baseline Widely available. stretch has limited support. The fit-content() function is experimental and not usable in browsers yet.

CSS Syntax

syntax.css
min-height: auto | <length> | <percentage> | min-content | max-content | fit-content | initial | inherit;

Same value set as other size properties. Prefer lengths and percentages for everyday layouts.

Property Values

ValueDescriptionTry it
autoDefault. Browser chooses the minimum; often no extra floorTry it
<length>Fixed floor such as 150px, 12rem, or 40vhTry it
<percentage>Percent of the containing block’s heightTry it
vs heightWhen the floor is larger than height, the floor winsTry it
initialResets to autoTry it
inheritTakes the parent’s min-heightTry it

How to Use min-height

Set a floor when short content should not collapse the box.

  1. Choose a length, a percentage, or leave auto.
  2. For percentages, give the containing block an explicit height.
  3. Remember: taller content still grows the box past the floor.
  4. Add max-height when you also need an upper limit.
PieceRequired?Role
Block-level or replaced boxYesDoes not apply to non-replaced inline elements
min-height valueYesauto, length, percentage, or keyword
Parent heightFor %Percentage uses the containing block height
height / max-heightOptionalPreferred size and upper cap; the floor can override a smaller height

Live Preview

Change min-height on a short box. The sample text is short on purpose so you can see the floor.

The outer frame is 220px tall so 50% has a parent height to resolve against.

Box
Short text

min-height: 150px

CSS Examples

Each snippet focuses on min-height. Use Try It Yourself for a live editor.

Example 1 — Fixed Length Floor

Give a short box a 150px minimum so it does not collapse.

CSS
<style>
  div {
    min-height: 150px;
  }
</style>

<div>Short text</div>
Try It Yourself

How It Works

  1. Set a floor. 150px is the smallest height allowed.
  2. Short content still fills it. The text is shorter than 150px, so empty space shows the minimum.
  3. Not a fixed height. Longer content can still grow the box past 150px.
  4. Other units work. Try rem, em, or vh the same way.

Example 2 — Percentage of Parent

Keep a child at least half of the parent’s height.

CSS
<style>
  .parent {
    height: 220px;
  }

  .child {
    min-height: 50%;
  }
</style>

<div class="parent">
  <div class="child">At least half</div>
</div>
Try It Yourself

How It Works

  1. Give the parent a height. 220px defines the containing block.
  2. Use a percentage on the child. 50% resolves to a 110px floor here.
  3. Parent height is required. Without an explicit parent height, the percent often acts like 0.
  4. Still a floor. Content taller than 110px can grow the child further.

Example 3 — Floor Overrides a Smaller Height

When min-height is larger than height, the used height becomes the floor.

CSS
<style>
  div {
    height: 80px;
    min-height: 150px;
  }
</style>

<div>Floor wins</div>
Try It Yourself

How It Works

  1. Ask for 80px. height: 80px is the preferred size.
  2. Set a taller floor. min-height: 150px is larger than that preferred size.
  3. The floor wins. The used height becomes 150px, not 80px.
  4. Same idea with max-height. If the floor is larger than max-height, the floor still wins.

Edge Cases & Pitfalls

Most confusion is about percentages, growth, and mixing with height.

percent

Percentage needs a sized containing block

If the parent height depends on content, a percentage min-height is treated as 0 for normal flow. Give the parent an explicit height.

grow

A floor is not a fixed height

Content larger than the minimum still expands the box. Use height for a preferred size and max-height for a cap.

win

min-height can beat height

When the floor is larger than height or max-height, the used height becomes the min-height value.

flex

Flex items default to min-height: auto

That auto minimum can stop a flex item from shrinking below its content. Set min-height: 0 when you need overflow or shrink behavior.

box

box-sizing still applies

With border-box, padding and border count inside the size. With content-box, they add outside it.

Browser Support

min-height is a browser layout property. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Length/% everywhere

min-height

Length and percentage values work in all modern browsers and older ones. Intrinsic keywords are widely supported in current engines. stretch is limited; fit-content() is not usable yet.

99% Length and % values
Google Chrome All versions · length/%
Full support
Mozilla Firefox All versions · length/%
Full support
Apple Safari All versions · length/%
Full support
Microsoft Edge All versions · length/%
Full support
Opera All versions · length/%
Full support
Samsung Internet All versions · length/%
Full support
Internet Explorer 6+ length/% · keywords limited
Partial
min-height Widely supported

Bottom line: Safe for every modern site. Prefer lengths and percentages for everyday work. Treat stretch as limited and fit-content() as experimental.

Key Takeaways

  • Role: set a minimum vertical height. The box can still grow with content.
  • Common values: auto, lengths, and percentages of the parent height.
  • Initial value: auto. Not inherited. A larger floor overrides a smaller height.
  • Tip: use min-block-size when the floor should follow writing mode.

One line: min-height is a vertical floor — not a fixed height, and not a maximum.

Frequently Asked Questions

It sets a minimum vertical height for an element. The box can still grow taller when content needs more space, but it cannot shrink below that floor.
The initial value is auto. The browser picks a minimum based on the element and layout rules, which often means no extra floor beyond content for ordinary blocks.
height sets a preferred or fixed height. min-height only sets a lower limit. If content is taller than the floor, the box grows. If min-height is larger than height, the used height becomes the min-height value.
Yes. Percentages resolve against the containing block height. If that height depends on content, the percentage is treated as 0 for non-absolutely positioned elements.
No. Set it on the element that needs the floor. Use inherit only when you want to copy a parent value on purpose.
Length and percentage values are supported in all modern browsers and older ones too. Intrinsic keywords and stretch have newer or limited support. It is a browser layout property, not a Node.js feature.

Next: min-inline-size

Learn the logical minimum size on the inline axis.

min-inline-size tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful