Style minWidth Property
- Föregående sida minHeight
- Nästa sida objectFit
- Åter till föregående nivå HTML DOM Style-objekt
Definition and Usage
minWidth
Property sets or returns the minimum width of an element.
minWidth
This property is only valid for block-level elements or elements with absolute or fixed positioning.
Tip:To set or return the maximum width of an element, use maxWidth property.
See also:
CSS Tutorial:CSS Dimension
CSS Reference Manual:min-width property
Instance
Example 1
Set the minimum width of the <div> element:
document.getElementById("myDIV").style.minWidth = "400px";
Example 2
Return the minimum width of the <p> element:
alert(document.getElementById("myP").style.minWidth);
Syntax
Return minWidth property:
object.style.minWidth
Set minWidth property:
object.style.minWidth = "length|%|initial|inherit"
Property value
Value | Description |
---|---|
length | Define the minimum width in length units. Default is 0. |
% | Define the minimum width in percentage of the parent element. |
initial | Set this property to its default value. See also initial. |
inherit | Inherit this property from its parent element. See also inherit. |
Technical details
Default value: | 0 |
---|---|
Return value: | A string representing the minimum width of an element. |
CSS version: | CSS2 |
Webbläsarstöd
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Stöd | Stöd | Stöd | Stöd | Stöd |
- Föregående sida minHeight
- Nästa sida objectFit
- Åter till föregående nivå HTML DOM Style-objekt