Sets the minimum height of an element.
The min-height property sets the minimum height of an element, preventing it from becoming shorter than the specified value. It overrides both height and max-height if either is smaller than min-height.
This property is useful for ensuring elements have a minimum size regardless of their content. A common pattern is using min-height: 100vh to make a section at least as tall as the viewport.
The min-height property is particularly useful in flex and grid layouts, where content size can vary. It accepts lengths, percentages, and intrinsic sizing keywords. The default value is auto, which in flex and grid contexts resolves to the content's minimum size.
| Name | Description | Optional |
|---|---|---|
value |
A length (200px, 10rem), percentage (50%), keyword (auto, min-content, max-content), or 0. | No |
.page {
min-height: 100vh;
}
.card {
min-height: 200px;
}