max-width

The max-width property constrains the width of an element to a maximum range.

CSS2

max-width: <length> | <percentage> | none | inherit
Initial: none
Applies To: all elements but non-replaced inline elements, table rows, and row groups
Inherited: no
Percentages: refer to width of containing block
Media: visual

Note: Doctype is required for Internet Explorer 8+

Values

Δ

max-width: value;
 
Value: Description:
inherit Takes the same computed value as the property for the element's parent
length Fixed maximum width
none No width limit
percentage Width percentage calculated with respect to the width of the containing block

DOM

Δ

[window.]document.getElementById("element-id").style.maxWidth = "max-width";

Example | Values | length

Δ

Example | Values | none

Δ

Example | Values | percentage

Δ

Example | DOM

Δ

Reference

Δ