Sizing
Utilities for setting the minimum height of an element.
Set the minimum height of an element using min-h-*
utilities.
<div class="h-96 ...">
<div class="min-h-80 ...">min-h-80</div>
<div class="min-h-64 ...">min-h-64</div>
<div class="min-h-48 ...">min-h-48</div>
<div class="min-h-40 ...">min-h-40</div>
<div class="min-h-32 ...">min-h-32</div>
<div class="min-h-24 ...">min-h-24</div>
<div class="min-h-full ...">min-h-full</div>
</div>
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.
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.
By default, Tailwind’s minimum height scale is a combination of the default spacing scale as well as some additional values specific to heights.
You can customize your spacing scale by editing theme.spacing
or theme.extend.spacing
in your tailwind.config.js
file.
module.exports = {
theme: {
extend: {
spacing: {
'128': '32rem',
}
}
}
}
To customize min-height
separately, use the theme.minHeight
section of your tailwind.config.js
file.
module.exports = {
theme: {
extend: {
minHeight: {
'128': '32rem',
}
}
}
}
Learn more about customizing the default theme in the theme customization documentation.
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-[220px]">
<!-- ... -->
</div>
Learn more about arbitrary value support in the arbitrary values documentation.