Style maxWidth Property
Style maxWidth Property
The maxWidth property is used to either set or return the maximum width of an element. It only works on those elements which are either in fixed or absolute position or are block-level elements. However, the width of an element is never greater than the max-width. For either setting or getting the minimum width of an element, we use the min-width property.
Syntax:-
Its syntax is:- object.style.maxWidth OR object.style.maxWidth = none | length | % | initial | inherit
Return:-
Its return is:- string having a maximum width of an element
Further Explanation:-
Value | Description |
---|---|
none | No limit on width of the element. |
length | Defines maximum width in length units. |
% | Defines maximum width in % of parent element. |
initial | Sets property to its default value. |
inherit | Inherits property from its parent element. |