CSS min-height Property

Description

The min-height property sets the minimum height of an element. Element height value will be calculated depending on the set values ​​of the height, max-height and min-height properties.

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

<div class="test">The block which the minimum height is set to 100px.</div>
.test {
   min-height: 100px;
   background: orange;
}

Browser Support

The following table will show you the current browser support for the CSS min-height property.

Desktop
Edge Chrome Firefox Opera Safari
121341.3
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
18414114.4

Last updated by CSSPortal on: 2nd January 2024