CSS Portal

CSS min-height Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The min-height property establishes a minimum height for an element’s used height, guaranteeing that the element will not be rendered shorter than that floor even when its content or layout conditions would otherwise make it smaller. It does not force an element to remain exactly that height; when the element’s content or other sizing rules require more space, the box will expand beyond the minimum. Which part of the box is constrained depends on the element’s sizing model, particularly box-sizing, because that determines whether padding and borders are included in the box’s sizing calculations.

In layout calculations, min-height interacts with explicit sizing and upper bounds: it acts as a lower bound that the final used height cannot fall below, while properties such as height and max-height participate in determining the resulting size. If an explicit height were to resolve smaller than the element’s minimum, the minimum value will take precedence; likewise, a maximum height can cap expansion beyond a ceiling. This relationship lets you express intentions like “don’t go below this minimum, but allow growth up to a larger constraint” without hard-coding a single fixed size.

When content exceeds the available space, the actual display of that overflow is controlled by overflow; min-height itself does not introduce scrolling or clipping, it only establishes the minimum area. For elements that participate in intrinsic sizing or in more complex layout contexts (for example, replaced elements or table cells), the minimum contributes to intrinsic minimum size calculations and can prevent collapsing behaviors that would otherwise reduce an element’s visible presence.

In modern layout patterns, min-height is particularly useful for maintaining usable and consistent interfaces. On flex items it constrains how small an item is allowed to become during flexing and therefore affects how free space is distributed by the layout algorithm — especially when combined with the flex property — helping prevent content from being squeezed to unreadable sizes. Designers use min-height to keep panels, cards, headers, or footers visually stable when content is sparse, to protect against accidental collapse of containers, and to ensure a minimum touch target or visual rhythm across different viewport sizes.

Definition

Initial value
0
Applies to
All elements except non-replaced inline elements and table elements
Inherited
No
Computed value
The percentage as specified or the absolute length
Animatable
Yes
JavaScript syntax
object.style.minHeight

Interactive Demo

This is a box where you can change the minimum height.
If there is more content than the minimum the box will grow to the height needed by the content.

Syntax

min-height: [ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content

Values

  • <length>Specifies a fixed width. Negative values are not allowed.
  • <percentage>A percentage relative to the width of the containing block. If the containing block has no width explicitly set then is is treated as none. Negative values are not allowed.
  • max-contentThe max-content width or height.
  • min-contentThe min-content width or height.
  • availableThe containing block width or height minus margin, border, and padding.
  • fit-contentIf the total available space is finite, equals to min(max-content, max(min-content, fill-available)). Otherwise, equal to the max-content measure. Requires CSS Intrinsic & Extrinsic Sizing Module support in browsers.

Example

<section class='examples'>
<h1>CSS min-height example</h1>

<div class='box short'>
<p>Box with min-height: 200px and little content.</p>
</div>

<div class='box tall'>
<p>Box with min-height: 200px and more content to show it grows beyond the min-height.</p>
<p>Additional paragraph to increase height.</p>
<p>Another paragraph to demonstrate expansion.</p>
</div>
</section>
/* Page and layout styles */
body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #f7f9fb;
  margin: 24px;
  color: #102a43;
}

.examples {
  max-width: 800px;
  margin: 0 auto;
}

h1 {
  font-size: 20px;
  margin-bottom: 12px;
}

/* Box appearance */
.box {
  background: linear-gradient(180deg, #ffffff 0%, #f0f8ff 100%);
  border: 1px solid #dbeffa;
  padding: 16px;
  margin: 16px 0;
  box-shadow: 0 2px 6px rgba(16, 42, 67, 0.06);
  transition: transform 0.15s ease;
}

.box:hover {
  transform: translateY(-4px);
}

/* Demonstrate min-height: both boxes use the same min-height
   The first box has little content so it remains at the min-height.
   The second box has more content so it grows beyond the min-height. */
.box.short {
  min-height: 200px;
}

.box.tall {
  min-height: 200px;
}

Browser Support

The following information will show you the current browser support for the CSS min-height property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!