Properties
CSS
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";
