CSS min-height Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Layout & Sizing

What You’ll Learn

The min-height property sets the minimum vertical height of an element. It is especially useful when you want to ensure a box never collapses too short while still letting taller content grow naturally.

01

Height Floor

Set a lower limit.

02

auto Default

Content minimum by default.

03

Pixels / vh

Fixed and viewport floors.

04

Percentages

Relative to parent.

05

Content Growth

Grows above minimum.

06

Related

height, max-height.

Introduction

The min-height property in CSS defines the minimum height of an element. This property is useful for ensuring elements do not collapse too short in a block formatting context while keeping layouts predictable on different screen sizes.

By specifying a minimum height, you can keep cards, panels, and sections visually balanced even when content is short, which helps maintain layout consistency across different devices and screen sizes.

Definition and Usage

min-height always sets a vertical floor in normal horizontal layouts. The element can grow taller when content needs more space, but it will not shrink below the minimum you set.

Use min-height alongside height and max-height for full vertical sizing control.

💡
Beginner Tip

Think of min-height as a floor: the box can grow taller when content needs more space, but it will not shrink below the minimum you set.

📝 Syntax

Write min-height with a length, percentage, or auto:

syntax.css
element {
  min-height: auto | length | percentage | initial | inherit;
}

Basic Example

min-height.css
.box {
  min-height: 200px;
  background-color: lightblue;
  border: 1px solid blue;
}

Syntax Rules

  • The initial value is auto, meaning no explicit minimum height constraint.
  • Length values such as px, rem, and vh set a fixed lower limit.
  • Percentages are relative to the containing block’s height.
  • Pair with height and max-height when you need preferred and maximum sizes too.

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toAll elements
InheritedNo
AnimatableNo
Common useCards, panels, and sections that must not collapse below a minimum height

🎯 Default Value

The default value of min-height is auto. Without explicit styling, the element has no explicit minimum height constraint and can shrink to fit its content based on other sizing properties.

💎 Property Values

These are the most common values you will use with min-height.

ValueExampleMeaning
automin-height: auto;No explicit minimum; content determines height (default)
Lengthmin-height: 200px;Defines a fixed minimum height using units such as px, rem, or vh
Percentagemin-height: 50%;Minimum height relative to the containing block height
200px

Fixed pixel floor for panels and cards.

Ensures boxes never collapse too small.

50%

Scales with the parent element height.

Parent needs a defined height.

auto

No explicit floor — content sets the minimum.

Default browser behavior.

min-height vs min-block-size

PropertyAxisBest for
min-block-sizeBlock axis (depends on writing mode)International layouts, reusable components, logical sizing systems
min-heightAlways verticalSimple pages with fixed minimum heights in horizontal writing
heightAlways verticalPreferred height paired with max/min limits
max-heightAlways verticalUpper limit on vertical size in horizontal writing

👀 Live Preview

Three boxes with different min-height floors and the same short text:

auto — minimum follows content.
4rem min — Short text in a taller box.
6rem min — Same short text with a roomier floor.

These values set a floor on vertical height. Taller content grows naturally above the minimum.

Examples Gallery

Try min-height with fixed floors, empty boxes, percentage minimums, and side-by-side comparisons.

📚 Minimum Height Floors

Ensure elements never collapse below a useful height, even when content is short.

Example 1 — 200px Minimum Height

Set a 200px floor so a box is always at least this tall, regardless of how little content it contains.

min-height-200.html
<style>
  .box {
    min-height: 200px;
    background-color: lightblue;
    border: 1px solid blue;
  }
</style>

<div class="box">
  This box has a minimum height of 200 pixels.
</div>
Try It Yourself

How It Works

The box is at least 200px tall. If content needs more space, the box grows taller automatically.

Example 2 — Minimum on an Empty Panel

Even with little content, min-height keeps the panel from collapsing.

min-height-empty.css
.panel {
  min-height: 120px;
  padding: 1rem;
  background: #dbeafe;
}
Try It Yourself

How It Works

A 120px minimum keeps the panel visually balanced even when content is only one line.

📈 Responsive Minimums

Use percentages and comparisons so minimum heights adapt across layouts.

Example 3 — Percentage Minimum (50%)

Set the minimum height to half of the parent’s height.

min-height-percent.css
.parent { height: 240px; }
.child {
  min-height: 50%;
  background: #93c5fd;
}
Try It Yourself

How It Works

The child will never be shorter than half of the parent’s height. Percentages need a defined parent height.

Example 4 — Compare auto vs Two Minimums

See how the same short content behaves with auto, a tight floor, and a roomier floor.

min-height-compare.css
.auto { min-height: auto; }
.sm { min-height: 100px; }
.md { min-height: 200px; }
Try It Yourself

How It Works

With auto, the box follows content height. Minimum values keep short content in taller boxes.

🧠 How min-height Works

1

You declare a minimum height

Choose a length, percentage, or leave the default auto so content determines the minimum.

CSS rule
2

Content determines natural height

The element sizes itself based on content, padding, and other height properties.

Box model
3

The browser enforces the floor

The box can grow taller when content needs more space, but it cannot shrink below min-height.

Constraint
=

Predictable minimum height

The element never falls below your minimum, keeping layouts tidy even when content is short.

Result

🖥 Browser Compatibility

The min-height property is widely supported across all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It is a well-established property you can use confidently to maintain consistent layouts.

Baseline · Universal support

Fundamental layout property

min-height has long been part of CSS layout and works consistently across browsers, much like height and max-height.

99% Browser support
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Opera All modern versions
Full support
min-height property 99% supported

Bottom line: You can rely on min-height in production layouts across all major browsers.

Conclusion

The min-height property is an essential tool for controlling the minimum size of elements on your web page. By ensuring elements have a minimum height, you can create more consistent and predictable layouts, especially in responsive designs.

Experiment with different values to see how they affect the layout and ensure your design remains robust across various screen sizes and content amounts.

💡 Best Practices

✅ Do

  • Use min-height on cards and panels that should not collapse when content is short
  • Use it alongside height and max-height for full vertical sizing control
  • Use viewport units like 50vh for responsive minimum heights
  • Test layouts on touch devices when panels must stay tall enough for tap targets
  • Prefer min-height for simple vertical floors with broad browser support

❌ Don’t

  • Set a minimum without considering how taller content should grow
  • Confuse min-height with height — one sets a floor, the other sets preferred size
  • Expect min-height: 50% to work when the parent height is undefined
  • Assume min-height always equals min-block-size in every layout
  • Skip min-block-size when layouts may change writing mode and need logical sizing

Key Takeaways

Knowledge Unlocked

Five things to remember about min-height

Use these points when setting vertical minimums in layouts.

5
Core concepts
📝02

auto Default

No explicit minimum limit.

Default
🔄03

Physical Axis

Always vertical.

Context
📈04

Content Growth

Grows above minimum.

UX
🛠05

Height Trio

height, min, max.

System

❓ Frequently Asked Questions

The min-height property sets the minimum vertical height of an element. The box can grow taller when content needs more space, but it cannot shrink below the minimum you set.
The default value is auto, which means the element is only as tall as its content requires, with no explicit minimum height constraint.
height sets a preferred or fixed size. min-height sets a lower limit only — the element can grow above it when content is taller.
Common values include auto, length units like px, em, rem, and vh, and percentages relative to the containing block height.
Yes. Percentages are relative to the containing block's height, so the parent usually needs an explicit height or min-height for the percentage to resolve predictably.

Practice in the Live Editor

Open the HTML editor, set min-height, and preview minimum height layouts instantly.

HTML Editor →

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