Sizing
Min-Width
Utilities for setting the minimum width of an element.
Quick reference
Class | Properties |
---|---|
min-w-0 | min-width: 0px; |
min-w-full | min-width: 100%; |
min-w-min | min-width: min-content; |
min-w-max | min-width: max-content; |
min-w-fit | min-width: fit-content; |
Basic usage
Setting the minimum width
Set the minimum width of an element using the min-w-{width}
utilities.
<span class="min-w-full ...">
<!-- ... -->
</span>
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-w-0
to only apply the min-w-0
utility on hover.
<div class="w-24 min-w-full hover:min-w-0">
<!-- ... -->
</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-w-0
to apply the min-w-0
utility at only medium screen sizes and above.
<div class="w-24 min-w-full md:min-w-0">
<!-- ... -->
</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-width
scale by editing theme.minWidth
or theme.extend.minWidth
in your tailwind.config.js
file.
tailwind.config.js
module.exports = { theme: { minWidth: { '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-width
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-w-[50%]">
<!-- ... -->
</div>
Learn more about arbitrary value support in the arbitrary values documentation.