The max-width property is used to define the maximum width of an element.
The value of the width cannot be larger than the value by maximum width. If the content is larger then it will go to the next line and if the content is smaller than maximum width then it has no effect. This maximum width property does not include padding, borders, or margins.
You can define maximum width values in percentage or length. Also, the values are none, initial, or inherit.
The following example shows the difference between width and maximum width property.