CSS Portal

CSS min-width Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The min-width property establishes the smallest inline size an element’s box is allowed to have during layout. When the available space or other sizing rules would otherwise shrink an element, min-width prevents it from becoming narrower than the specified minimum, ensuring content, controls, or visual components remain usable and legible. It ties into the browser’s intrinsic sizing behavior: if an element’s content or intrinsic minimum size is larger than the computed minimum, that intrinsic requirement will still influence the final size, but the explicit min-width acts as a lower bound the layout engine cannot go beneath.

In practical layouts, min-width interacts with other sizing constraints. For example, an explicitly set width that is smaller than the minimum will be overridden by the minimum, and a max-width can cap expansion while leaving the minimum as a lower limit; the computed size is determined by resolving these constraints together. How the minimum is applied also depends on box measurement model: with box-sizing the interpretation of what constitutes the element’s width (content box vs border-box) changes whether padding and borders are inside or outside the minimum calculation. If an element cannot fit within the constrained space because of its minimum size, that can produce overflow, which is governed by the overflow behavior and may cause scrollbars or visual clipping.

In modern layout modules, min-width is especially important. Within a flex formatting context it acts as a constraint during the flex algorithm: an item’s minimum size can prevent it from shrinking below a usable threshold even when flex factors would otherwise reduce it, and it interacts with properties like flex-basis and the flex shrink/grow calculations to determine final sizes. Similarly, in responsive designs you can use a minimum to keep interactive controls tappable, stop text from reflowing awkwardly, or ensure images and replaced elements maintain a sensible minimum display size. Thoughtful use of min-width helps preserve usability and visual stability across varying viewport sizes and layout constraints.

Definition

Initial value
0
Applies to
All elements except non-replaced inline elements and table elements
Inherited
No
Computed value
The percentage as specified or the absolute length
Animatable
Yes
JavaScript syntax
object.style.minWidth

Interactive Demo

Change the minimum width.

Syntax

min-width: [ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content

Values

  • <length>Specifies a fixed width. Negative values are not allowed.
  • <percentage>A percentage relative to the width of the containing block. If the containing block has no width explicitly set then is is treated as none. Negative values are not allowed.
  • max-contentThe max-content width or height.
  • min-contentThe min-content width or height.
  • availableThe containing block width or height minus margin, border, and padding.
  • fit-contentIf the total available space is finite, equals to min(max-content, max(min-content, fill-available)). Otherwise, equal to the max-content measure. Requires CSS Intrinsic & Extrinsic Sizing Module support in browsers.

Example

<div class="demo">
<h2>CSS min-width demo</h2>
<div class="controls">
<div class="box box-no-min">
<p>Without min-width</p>
<p>Will shrink below 150px</p>
</div>
<div class="box box-min">
<p>With min-width: 150px</p>
<p>Will not shrink below 150px</p>
</div>
</div>
<p class="hint">Resize the window to see how the right box respects min-width.</p>
</div>
.demo {
  max-width: 800px;
  margin: 24px auto;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  padding: 16px;
}

.controls {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  border: 1px solid #ddd;
  padding: 12px;
  background: #fafafa;
}

.box {
  flex: 1 1 0;
  padding: 12px;
  background: linear-gradient(180deg,#fff,#f6f8fa);
  border: 1px solid #ccc;
  text-align: center;
}

.box-no-min {
  min-width: 0; /* allows shrinking */
}

.box-min {
  min-width: 150px;
}

.hint {
  color: #555;
  margin-top: 12px;
  font-size: 14px;
}

Browser Support

The following information will show you the current browser support for the CSS min-width property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!