Specifies the maximum width for the visible area of an element.
This property has effect only on block-level elements or on elements with absolute or fixed position. The max-width property contains only the pure width of the visible content, without the padding, scrollbar, border and the margin.
The width of an element can never be greater than the value specified by the max-width property.
Note that this property works in Internet Explorer only from version 7.
One of the following values:
|Takes the value of this property from the computed style of the parent element.|
|No limit on the width of the element.|
|The maximum width for the element in length units. For the supported length units, see the length page.|
|The maximum width for the element is the specified percentage of the width of the parent element.|
Example HTML code 1:
This example illustrates the use of the max-width property:
Did you find this example helpful?
Supported by tags:
User Contributed Comments