Skip to content

min-width

Utilities for setting the minimum width of an element.

Quick reference

ClassStyles
min-w-<number>min-width: calc(var(--spacing) * <number>);
min-w-<fraction>min-width: calc(<fraction> * 100%);
min-w-3xsmin-width: var(--container-3xs); /* 16rem (256px) */
min-w-2xsmin-width: var(--container-2xs); /* 18rem (288px) */
min-w-xsmin-width: var(--container-xs); /* 20rem (320px) */
min-w-smmin-width: var(--container-sm); /* 24rem (384px) */
min-w-mdmin-width: var(--container-md); /* 28rem (448px) */
min-w-lgmin-width: var(--container-lg); /* 32rem (512px) */
min-w-xlmin-width: var(--container-xl); /* 36rem (576px) */
min-w-2xlmin-width: var(--container-2xl); /* 42rem (672px) */
min-w-3xlmin-width: var(--container-3xl); /* 48rem (768px) */
min-w-4xlmin-width: var(--container-4xl); /* 56rem (896px) */
min-w-5xlmin-width: var(--container-5xl); /* 64rem (1024px) */
min-w-6xlmin-width: var(--container-6xl); /* 72rem (1152px) */
min-w-7xlmin-width: var(--container-7xl); /* 80rem (1280px) */
min-w-automin-width: auto;
min-w-pxmin-width: 1px;
min-w-fullmin-width: 100%;
min-w-screenmin-width: 100vw;
min-w-dvwmin-width: 100dvw;
min-w-dvhmin-width: 100dvh;
min-w-lvwmin-width: 100lvw;
min-w-lvhmin-width: 100lvh;
min-w-svwmin-width: 100svw;
min-w-svhmin-width: 100svh;
min-w-minmin-width: min-content;
min-w-maxmin-width: max-content;
min-w-fitmin-width: fit-content;
min-w-(<custom-property>)min-width: var(<custom-property>);
min-w-[<value>]min-width: <value>;

Source: https://tailwindcss.com/guide/min-width

Examples

Basic example

Use min-w-&lt;number&gt; utilities like min-w-24 and min-w-64 to set an element to a fixed minimum width based on the spacing scale:

min-w-80

min-w-64

min-w-48

min-w-40

min-w-32

min-w-24

<div class="w-20 ...">
  <div class="min-w-80 ...">min-w-80</div>
  <div class="min-w-64 ...">min-w-64</div>
  <div class="min-w-48 ...">min-w-48</div>
  <div class="min-w-40 ...">min-w-40</div>
  <div class="min-w-32 ...">min-w-32</div>
  <div class="min-w-24 ...">min-w-24</div>
</div>

Using a percentage

Use min-w-full or min-w-&lt;fraction&gt; utilities like min-w-1/2 and min-w-3/4 to give an element a percentage-based minimum width:

min-w-3/4

w-full

<div class="flex gap-3 ...">
  <div class="min-w-3/4 ...">min-w-3/4</div>
  <div class="w-full ...">w-full</div>
</div>

Using the container scale

Use utilities like min-w-sm and min-w-xl to set an element to a fixed minimum width based on the container scale:

min-w-lg

min-w-md

min-w-sm

min-w-xs

min-w-2xs

min-w-3xs

<div class="w-40 ...">
  <div class="min-w-lg ...">min-w-lg</div>
  <div class="min-w-md ...">min-w-md</div>
  <div class="min-w-sm ...">min-w-sm</div>
  <div class="min-w-xs ...">min-w-xs</div>
  <div class="min-w-2xs ...">min-w-2xs</div>
  <div class="min-w-3xs ...">min-w-3xs</div>
</div>

Matching the viewport

Use the min-w-screen utility to make an element span at least the entire width of the viewport:

<div class="min-w-screen">
  <!-- ... -->
</div>

Alternatively, you can match the width of the large, small or dynamic viewports using the min-w-lvw, min-w-svw, and min-w-dvw utilities.

Resetting the minimum width

Use the min-w-0 utility to remove an element's assigned minimum width under a specific condition, like at a particular breakpoint:

<div class="w-24 min-w-full md:min-w-0">
  <!-- ... -->
</div>

Using a custom value

Use the min-w-[&lt;value&gt;] syntax to set the minimum width based on a completely custom value:

<div class="min-w-[220px] ...">
  <!-- ... -->
</div>

For CSS variables, you can also use the min-w-(&lt;custom-property&gt;) syntax:

<div class="min-w-(--my-min-width) ...">
  <!-- ... -->
</div>

This is just a shorthand for min-w-[var(&lt;custom-property&gt;)] that adds the var() function for you automatically.

Responsive design

Prefix a min-width utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

<div class="w-24 min-w-full md:min-w-0 ...">
  <!-- ... -->
</div>

Learn more about using variants in the variants documentation.

Customizing your theme

The min-w-&lt;number&gt; utilities are driven by the --spacing theme variable, which can be customized in your own theme:

css
@theme {
  --spacing: 1px;
}

Learn more about customizing the spacing scale in the theme variable documentation.

Released under the MIT License.