min-width

The min-width CSS property is used to set the minimum width of an element. It prevents the used value of the width property from becoming smaller than the value specified for min-width.

/* <length> value */
min-width: 3.5em;

/* <percentage> value */
min-width: 10%;

/* Keyword values */
min-width: max-content;
min-width: min-content;
min-width: fit-content;
min-width: fill-available;

/* Global values */
min-width: inherit;
min-width: initial;
min-width: unset;

The element width is set to the value of min-width whenever min-width is larger than max-width or whenever min-width is larger than width.

Initial value0
Applies toall elements but non-replaced inline elements, table rows, and row groups
Inheritedno
Percentagesrefer to the width of the containing block
Mediavisual
Computed valuethe percentage as specified or the absolute length
Animation typea length, percentage or calc();
Canonical orderthe unique non-ambiguous order defined by the formal grammar

Syntax

Values

<length>
The minimum width, expressed as a <length>. Negative values make the declaration invalid.
<percentage>
The minimum width, expressed as a <percentage> of the containing block's width. Negative values make the declaration invalid.
auto
The default minimum size for flex items, providing a more reasonable default than 0 for other layouts.
max-content
The intrinsic preferred width.
min-content
The intrinsic minimum width.
fill-available
The containing block's width minus horizontal margin, border, and padding. Some browsers implement an ancient name for this keyword, available.
fit-content
Defined as min(max-content, max(min-content, fill-available).

Formal syntax

<length> | <percentage> | auto | max-content | min-content | fit-content | fill-available

Examples

table { min-width: 75%; }

form { min-width: 0; }

Specifications

Specification Status Comment
CSS Intrinsic & Extrinsic Sizing Module Level 3
The definition of 'min-width' in that specification.
Working Draft Adds the max-content, min-content, fit-content, and fill-available keywords. (At some times in the past, both CSS3 Box and CSS3 Writing Modes drafts defined these keywords. These drafts has been superseded by this specification.)
CSS Flexible Box Layout Module
The definition of 'min-width' in that specification.
Candidate Recommendation Added the auto keyword and used it as the initial value.
CSS Transitions
The definition of 'min-width' in that specification.
Working Draft Defines min-width as animatable.
CSS Level 2 (Revision 1)
The definition of 'min-width' in that specification.
Recommendation Initial definition

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 (Yes) 1.0 (1.0) 7.0 4.0 2.0.2 (416), buggy before
applies to <table> [1] No support No support (Yes) No support (Yes) No support
max-content, min-content, fit-content, and fill-available 24.0 -webkit [3] No support 3.0 (1.9) -moz [2] No support No support No support [3]
auto 21.0 [4] ? 16.0 (16.0) [4]
Removed in 22.0 (22.0)
Reintroduced in 34.0 (34.0) with the new behavior defined by the spec.
No support 12.10 [6] No support
auto as initial value 21.0 ? 18.0 (18.0)
Removed in 22.0 (22.0)
No support 12.10 No support
Feature Android Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? (Yes) ? ? ? ?[5]
applies to <table> [1] ? ? No support ? ? ? ?
max-content, min-content, fit-content, and fill-available ? ? No support ? ? ? ?
auto ? ? ? ? ? ? ?
auto as initial value ? ? ? ? ? ? ?

[1] CSS 2.1 explicitly leaves the behavior of min-width with <table> undefined. Therefore any behavior is CSS2.1-compliant; newer CSS specifications may define this behavior, so Web developers shouldn't rely on a specific one now.

[2] Gecko experimentally implements the definitions given in CSS3 Basic Box. This one defines available and not fill-available. Also the definition of fit-content is simpler than in CSS3 Intrinsic.

[3] WebKit also implements an earlier proposal, the keyword intrinsic.

[4] These implementations where implementing a slightly simpler behavior for this keyword: it computed to min-content on flex items, and it computes to 0 on everything else.

[5] In some browsers, on iOS, a <button> element in its native (default) configuration will not respond to min-width.    This problem is due to native buttons.  A <span> inside a native button will exhibit the same problem, despite having "display:inline-block" set.  When changes are made to other style parameters and the browser is forced to abandon the native button, the min-width setting takes affect.  

See also