style.maxWidth (Property)

Defines the maximum width of a styled element.

Availability:

CSS level - 2
DOM level - 2
JavaScript - 1.5
JScript - 5.0
Internet Explorer - 5.0
Netscape - 6.0
Property/method value type:String primitive
JavaScript syntax:-myStyle.maxWidth
CSS syntax:max-width: aValue
Argument list:aValueA maximum width value

This property provides a means of specifying the maximum width of an element so that it cannot get any bigger, regardless of the implications of the document flow and automatic browser formatting.

The value is expressed in the usual measurement units (either pixels or fractions of an em-dash). You can also use the percentage of the containing element as a maximum size.

The size of an element can be constrained using the minimum/maximum extents for the height and width. This ensures that the element's size will fall within the permitted bounds, but yet still have some flexibility to allow the document flow to respond to window sizing.

See also:Measurement units, style.maxHeight, style.minWidth