Syntax
max-width: value;
Example
max-width: 1200px;
Common use cases
- Capping content width on large screens
- Readable line lengths in typography
- Responsive containers that don't stretch infinitely
Practical developer insight
max-width overrides width — if both are set, the smaller value wins. Combine with margin: 0 auto to center capped containers.