CSS max-width Property
In CSS, the max-width property is used to specify the maximum width of an element. The width value cannot be greater than the value returned by max-width. If the content is larger than the maximum width, it will move to the next line; if the content is smaller than the maximum width, it has no effect.
Syntax
Property Values
| Value | Description |
|---|---|
| none | There is no maximum height. This is the default setting. |
| length | Defines the maximum height in pixels, centimeters, and so on. Learn more about length units. |
| % | Defines the maximum height of the containing block in percentage terms. |
| initial | This property is set to its default value. |
| inherit | This property is inherited from its parent element. |
Supported Browsers
| Property | Chrome | Firefox | Safari | Edge / IE | Opera |
|---|---|---|---|---|---|
| max-width | 1.0 | 1.0 | 2.0 | 7.0 | 7.0 |