CSS max-widthProperty


Example

Set the maximum width of the paragraph:

p
{
max-width:100px;
}

Try it Yourself »

Property definition and usage instructions

The max-width property sets the maximum width of an element.

Note:The max-width property does not include padding, borders, or margins!

Default value: none
Inherited: no
version: CSS2
JavaScript Syntax: object.style.maxWidth="100px"


Browser Support

The numbers in the table indicate the first browser version number that supports the property.

Property
max-width 1.0 7.0 1.0 2.0.2 7.0

Property value

Value Description
none Default. Defines no limit on the maximum width of the element.
length Defines the maximum width value of the element.
% Defines a percentage maximum width based on the containing block object.
inherit Specifies that the value of the max-width property should be inherited from the parent element.


Related Articles

CSS Tutorial:CSS Dimension

CSS Reference Manual:min-width property

other extensions