The width CSS descriptor is shorthand for setting both the min-width
and the max-width
descriptors of the viewport. By providing one viewport length value, that value will determine both the min-width
and the max-width
to the value provided.
If two viewport values are provided the first value will be set to the min-width
and the second value will be set max-width
.
/* An example with one viewport value: */ @viewport { width: 320px; } /* An example with two viewport values: */ @viewport { width: 320px, 120px; }
auto
<length>
<percentage>
Related at-rule | @viewport |
---|---|
Initial value | as each of the properties of the shorthand: |
Percentages | as each of the properties of the shorthand: |
Computed value | as each of the properties of the shorthand: |
<viewport-length>{1,2}where
<viewport-length> = auto | <length-percentage>where
<length-percentage> = <length> | <percentage>
@viewport { width: 500px; }
Specification | Status | Comment |
---|---|---|
CSS Device Adaptation The definition of '"min-width" descriptor' in that specification. | Working Draft | Initial definition |
Desktop | ||||||
---|---|---|---|---|---|---|
width descriptor |
29 — 84 | 12
|
No | 10
|
16
|
No |
Mobile | ||||||
---|---|---|---|---|---|---|
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/width