This paragraph has a width of 100px.
When you click the button below,
the minimum width is set to 200px,
so this paragraph becomes 200 pixels wide.
Prop Style Minwidth
# Style minWidth Property
[ Style Object](#)
* * *
## Definition and Usage
The minWidth property sets or returns the minimum width of an element.
The minWidth property only works on block-level elements or absolutely/fixed positioned elements.
## Syntax
Set the minWidth property:
Object.style.minWidth="_length|%_|inherit"
Return the minWidth property:
Object.style.minWidth
| Value | Description |
| :--- | :--- |
| _length_ | Defines the minimum width in units like px, cm, etc. Default is 0. |
| _%_ | Defines the minimum width as a percentage of the parent element. |
| inherit | The value of the minWidth property is inherited from its parent element. |
* * *
## Browser Support

The minWidth property is supported by all major browsers.
**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 only supports "inherit" if a !DOCTYPE is specified. IE9 supports "inherit".
* * *
## Example
## Example
Set the minimum width of an element:
function displayResult(){
document.getElementById("p1").style.minWidth="200px";
}
YouTip