Sizing
Min-Height
Utilities for setting the minimum height of an element.
Quick reference
Class | Properties |
---|---|
min-h-0 | min-height: 0px; |
min-h-full | min-height: 100%; |
min-h-screen | min-height: 100vh; |
min-h-min | min-height: min-content; |
min-h-max | min-height: max-content; |
min-h-fit | min-height: fit-content; |
Basic usage
Setting the minimum height
Set the minimum height of an element using the min-h-0
, min-h-full
, or min-h-screen
utilities.
<div class="h-48">
<div class="h-24 min-h-full">
<!-- ... -->
</div>
</div>
Applying conditionally
Hover, focus, and other states
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:min-h-full
to only apply the min-h-full
utility on hover.
<div class="h-24 min-h-0 hover:min-h-full">
<!-- ... -->
</div>
For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.
Breakpoints and media queries
You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:min-h-full
to apply the min-h-full
utility at only medium screen sizes and above.
<div class="h-24 min-h-0 md:min-h-full">
<!-- ... -->
</div>
To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.
Using custom values
Customizing your theme
You can customize your min-height
scale by editing theme.minHeight
or theme.extend.minHeight
in your tailwind.config.js
file.
tailwind.config.js
module.exports = {
theme: {
minHeight: {
'1/2': '50%',
}
}
}
Learn more about customizing the default theme in the theme customization documentation.
Arbitrary values
If you need to use a one-off min-height
value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.
<div class="min-h-[50%]">
<!-- ... -->
</div>
Learn more about arbitrary value support in the arbitrary values documentation.