CSS min-width Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The min-width property sets the minimum horizontal width of an element. It stops the used width from going smaller than the value you set.

It is not inherited. The initial value is auto. Content can still make the box grow wider. For a writing-mode-aware floor, use min-inline-size. Pair with max-width when you also need a cap.

Standard-track.

Not deprecated. Length and percentage values are Baseline Widely available. stretch has limited support. The fit-content() function is experimental and not usable in browsers yet.

CSS Syntax

syntax.css
min-width: auto | <length> | <percentage> | min-content | max-content | fit-content | initial | inherit;

Same value set as other size properties. Prefer lengths and percentages for everyday layouts.

Property Values

ValueDescriptionTry it
autoDefault. Often 0 for blocks; content-based for flex/grid itemsTry it
<length>Fixed floor such as 200px, 12rem, or 40vwTry it
<percentage>Percent of the containing block’s widthTry it
vs widthWhen the floor is larger than width, the floor winsTry it
initialResets to autoTry it
inheritTakes the parent’s min-widthTry it

How to Use min-width

Set a floor when short content should not collapse the box horizontally.

  1. Choose a length, a percentage, or leave auto.
  2. For percentages, give the containing block an explicit width.
  3. Remember: wider content still grows the box past the floor.
  4. Add max-width when you also need an upper limit.
PieceRequired?Role
Block-level or replaced boxYesDoes not apply to non-replaced inline elements
min-width valueYesauto, length, percentage, or keyword
Parent widthFor %Percentage uses the containing block width
width / max-widthOptionalPreferred size and upper cap; the floor can override a smaller width

Live Preview

Change min-width on a short label. The sample text is short on purpose so you can see the floor.

The outer frame is 320px wide so 50% has a parent width to resolve against.

Box
Hi

min-width: 200px

CSS Examples

Each snippet focuses on min-width. Use Try It Yourself for a live editor.

Example 1 — Fixed Length Floor

Give a short label a 200px minimum so it does not collapse.

CSS
<style>
  div {
    min-width: 200px;
  }
</style>

<div>Hi</div>
Try It Yourself

How It Works

  1. Set a floor. 200px is the smallest width allowed.
  2. Short content still fills it. “Hi” is narrower than 200px, so empty space shows the minimum.
  3. Not a fixed width. Longer content can still grow the box past 200px.
  4. Other units work. Try rem, em, ch, or vw the same way.

Example 2 — Percentage of Parent

Keep a child at least half of the parent’s width.

CSS
<style>
  .parent {
    width: 320px;
  }

  .child {
    min-width: 50%;
  }
</style>

<div class="parent">
  <div class="child">At least half</div>
</div>
Try It Yourself

How It Works

  1. Give the parent a width. 320px defines the containing block.
  2. Use a percentage on the child. 50% resolves to a 160px floor here.
  3. Parent width helps. A clear containing-block width makes the percent predictable.
  4. Still a floor. Content wider than 160px can grow the child further.

Example 3 — Floor Overrides a Smaller Width

When min-width is larger than width, the used width becomes the floor.

CSS
<style>
  div {
    width: 80px;
    min-width: 200px;
  }
</style>

<div>Floor wins</div>
Try It Yourself

How It Works

  1. Ask for 80px. width: 80px is the preferred size.
  2. Set a wider floor. min-width: 200px is larger than that preferred size.
  3. The floor wins. The used width becomes 200px, not 80px.
  4. Same idea with max-width. If the floor is larger than max-width, the floor still wins.

Edge Cases & Pitfalls

Most confusion is about growth, mixing with width, and flex/grid auto minima.

grow

A floor is not a fixed width

Content larger than the minimum still expands the box. Use width for a preferred size and max-width for a cap.

win

min-width can beat width

When the floor is larger than width or max-width, the used width becomes the min-width value.

flex

Flex/grid auto is content-based

On flex and grid items, min-width: auto can stop shrinking below content size. Set min-width: 0 when you need overflow or shrink behavior.

percent

Percentage uses the containing block width

Percentages resolve against the parent’s width. Make that width clear when you rely on a percentage floor.

box

box-sizing still applies

With border-box, padding and border count inside the size. With content-box, they add outside it.

Browser Support

min-width is a browser layout property. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Length/% everywhere

min-width

Length and percentage values work in all modern browsers and older ones. Intrinsic keywords are widely supported in current engines. stretch is limited; fit-content() is not usable yet.

99% Length and % values
Google Chrome All versions · length/%
Full support
Mozilla Firefox All versions · length/%
Full support
Apple Safari All versions · length/%
Full support
Microsoft Edge All versions · length/%
Full support
Opera All versions · length/%
Full support
Samsung Internet All versions · length/%
Full support
Internet Explorer 6+ length/% · keywords limited
Partial
min-width Widely supported

Bottom line: Safe for every modern site. Prefer lengths and percentages for everyday work. Treat stretch as limited and fit-content() as experimental.

Key Takeaways

  • Role: set a minimum horizontal width. The box can still grow with content.
  • Common values: auto, lengths, and percentages of the parent width.
  • Initial value: auto. Not inherited. A larger floor overrides a smaller width.
  • Tip: use min-inline-size when the floor should follow writing mode.

One line: min-width is a horizontal floor — not a fixed width, and not a maximum.

Frequently Asked Questions

It sets a minimum horizontal width for an element. The box can still grow wider when content needs more space, but it cannot shrink below that floor.
The initial value is auto. For ordinary block boxes that usually resolves to 0. For flex and grid items, auto can mean a content-based minimum that stops the item from shrinking below its content.
width sets a preferred or fixed width. min-width only sets a lower limit. If content is wider than the floor, the box grows. If min-width is larger than width, the used width becomes the min-width value.
Yes. Percentages resolve against the containing block width. Give the parent an explicit width when you want a predictable percentage floor.
No. Set it on the element that needs the floor. Use inherit only when you want to copy a parent value on purpose.
Length and percentage values are supported in all modern browsers and older ones too. Intrinsic keywords and stretch have newer or limited support. It is a browser layout property, not a Node.js feature.

Next: mix-blend-mode

Learn how an element’s content blends with the backdrop behind it.

mix-blend-mode tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful