THE WORLD'S LARGEST WEB DEVELOPER SITE

CSS min-width Property


Example

Set the minimum width of a <p> element:

p {
    min-width: 150px;
}

Try it yourself »

Definition and Usage

The min-width property is used to set the minimum width of an element.

This prevents the value of the width property from becoming smaller than min-width.

Note: The value of the min-width property overrides both max-width and width.

Default value: 0
Inherited: no
Animatable: yes, see individual properties. Read about animatable Try it
Version: CSS2
JavaScript syntax: object.style.minWidth="400px" Try it

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
min-width 1.0 7.0 1.0 2.0.2 4.0

CSS Syntax

min-width: length|initial|inherit;

Property Values

Value Description Play it
length Default value is 0. Defines the minimum width in px, cm, etc.  Play it »
% Defines the minimum width in percent of the containing block Play it »
initial Sets this property to its default value. Read about initial Play it »
inherit Inherits this property from its parent element. Read about inherit

Related Pages

CSS tutorial: CSS Dimension

CSS reference: max-width property

HTML DOM reference: minWidth property



COLOR PICKER

colorpicker

SHARE THIS PAGE






Search w3schools.com:

Translate w3schools.com: