New! My 44-page ebook "CSS in 44 minutes" is out! 😃

Get it now →

#max-width

Defines the maximum width the element can be.

default max-width: none;

The element has no limit in terms of width.

max-width: 2000px;

You can use numeric values like pixels, (r)em, percentages...

If the maximum width is larger than the element's actual width, the max width has no effect.

max-width: 150px;

If the content does not fit within the maximum width, it will automatically change the height of the element to accomodate for the wrapping of the content.