min-width
Specifies the minimum width of an element.
Sample Code
p.test { min-width: 500px;}
p.test1 { min-width: 0;}
Available Values
| Value | Description |
|---|---|
| number | A numeric value. Commonly used units are 'px' and '%'. Negative values are not allowed. When specified as '%', the reference size is the width of the containing block. The initial value is '0'. |
Browser Display Result
<div style="min-width: 500px; background-color: #ff0;">This is a div element. 'min-width: 500px' is specified.</div>
<div style="width: 500px; border: solid 1px #f00;"> <div style="min-width: 80%; width: 300px; background-color: #ff0;">This is a div inside a div. The parent div (red border) has 'width: 500px'. This element (yellow background) has 'min-width: 80%' and 'width: 300px'. Its minimum width is relative to the parent's width, giving a minimum of '400px'. Since '400px' is greater than 'width: 300px', this element's width becomes '400px'.</div> </div>
8
6
3 and earlier
Android Browser