Min-Height Property

Last updated: 2026-09-13

min-height Min-Height Property

The min-height property sets the minimum height of an element, ensuring it keeps a certain height even when its content is short. Its default value, 0, means there is no lower limit. It is often used to keep page sections visually consistent or to pin a footer to the bottom of the page.

Category
Initial Value0
InheritedNo
Applies Tonon-replaced
Animation Typelength
CSS VersionCSS2
StatusStandard

📝 Syntax

min-height: auto | <length> | <percentage> | min-content | max-content | fit-content;

⚙️ Values

ValueTypeDescription
0KeywordNo minimum height.
<length>TypeA fixed minimum height.

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
min-height v1 v12 v1 v1 v1
Supported in all major browsers
Tip: min-height takes precedence over height and max-height, and the element grows automatically when content is taller.

❓ FAQ

QWhat's the difference between min-height and height?
Aheight is a fixed height, so content taller than the set value overflows the box and is visible by default. min-height only sets a lower bound: with short content the element keeps the set height, and with tall content it grows automatically without overflowing. That is why min-height is the safer, more flexible choice for components with unknown content lengths, such as cards, modals, and page bodies.
QHow do I make the page body fill at least one screen?
AGive the main container min-height:100vh. With little content the body still fills at least the viewport height, and with more content it extends downward, so the footer never dangles mid-screen. 100vh means 100% of the viewport height. Unlike height:100vh, min-height lets the page scroll normally once content exceeds one screen instead of being locked to a fixed height. It is the standard pattern for app shells and article pages alike.
QWhich is better: min-height:100vh or height:100vh?
Aheight:100vh fixes the height to the viewport, so longer content overflows or must scroll internally, which suits single-screen apps like mobile activity pages. min-height:100vh guarantees at least one screen while letting the element grow with content, making it ideal for ordinary page layouts. Most websites should use min-height:100vh, and combined with flex it also enables a sticky footer, since the main area can flex to push the footer to the bottom of short viewports.
QWhy doesn't the min-height percentage take effect?
ALike height, a percentage min-height is computed against the parent's content area height, and it fails when the parent's height is auto. To make a child fill the parent's height, the parent needs a definite height first, or you can switch to a flex layout where items stretch automatically, since align-items defaults to stretch. That is the recommended approach in most cases.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏