The max-width
CSS descriptor specifies the maximum width of the viewport of a document defined via the @viewport
at-rule.
By default, the width is set as close as possible to the initial viewport considering the maximum width constraint.
/* Keyword value */ max-width: auto; /* <length> values */ max-width: 600px; max-width: 80em; max-width: 15cm; /* <percentage> value */ max-width: 75%;
auto
<length>
<percentage>
Related at-rule | @viewport |
---|---|
Initial value | auto |
Percentages | refer to the width of the initial viewport |
Computed value | if specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, auto
|
<viewport-length>where
<viewport-length> = auto | <length-percentage>where
<length-percentage> = <length> | <percentage>
@viewport { max-width: 600px; }
Specification | Status | Comment |
---|---|---|
CSS Device Adaptation The definition of '"max-width" descriptor' in that specification. | Working Draft | Initial definition |
Desktop | ||||||
---|---|---|---|---|---|---|
max-width descriptor |
29 — 84 | 12
|
No | 10
|
16
|
No |
Mobile | ||||||
---|---|---|---|---|---|---|
max-width descriptor |
4.4 — 37 | 29 — 84 | No | 16
|
No | 2.0 |
© 2005–2020 Mozilla and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/@viewport/max-width