Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

CSS Dictionary

  1. Home
  2. CSS Dictionary
  3. min-height

min-height

Specifies the minimum height of an element.

Sample Code

style.css
/* px: ensure a minimum height of 500px */
div.test { min-height: 500px;}

/* 0: no minimum height (initial value) */
div.test2 { min-height: 0;}

/* vh: ensure element covers the full viewport height */
.hero { min-height: 100vh;}

/* Sticky footer pattern */
body { display: flex; flex-direction: column; min-height: 100vh;}
footer { margin-top: auto;}

/* Keep cards at a consistent height even with little content */
.card { min-height: 200px;}

Available Values

ValueDescription
numberA numeric value. Commonly used units are 'px' and '%'. Negative values are not allowed. When specified as '%', the reference size is the height of the containing block. The initial value is '0'.

Browser Display Result

<div style="min-height: 100px; background-color: #ff0;">This is a div element. 'min-height: 100px' is specified.</div>

<div style="height: 300px; border: solid 1px #f00;">
	<div style="min-height: 80%; height: 200px; background-color: #ff0;">This is a div inside a div. The parent div (red border) has 'height: 300px'. This element (yellow background) has 'min-height: 80%' and 'height: 200px'. Its minimum height is relative to the parent's height, giving a minimum of '240px'. Since '240px' is greater than 'height: 200px', this element's height becomes '240px'.</div>
</div>

Browser Compatibility

Chrome Chrome
1+
Firefox Firefox
3+
2 and earlier ×
Safari Safari
1.3+
Edge Edge
12+
IE IE
11
10
9
8
7
6 ×
Opera Opera
4+
3 and earlier ×
iOS Safari iOS Safari
1+
Android Android Browser
4.4+
3 and earlier ×
Chrome Android Chrome Android
Latest
Same support as desktop
Firefox Android Firefox Android
Latest
Same support as desktop

※ Version data is based on MDN.

If you find any errors or copyright issues, please .