width
CSS descriptor is shorthand for setting both the
min-width
和
max-width
descriptors of the viewport. By providing one viewport length value, that value will determine both the
min-width
和
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
The used value is calculated from the other CSS descriptors' values.
<length>
A non-negative absolute or relative length.
<percentage>
| 相关 at-rule |
@viewport
|
|---|---|
| 初始值 |
as each of the properties of the shorthand:
|
| 百分比 |
as each of the properties of the shorthand:
|
| 计算值 |
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;
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Device Adaptation
The definition of '"min-width" descriptor' in that specification. |
工作草案 | 初始定义 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
width
descriptor
|
Chrome 不支持 29 — 84 |
Edge
完整支持
12
Prefixed
|
Firefox 不支持 No |
IE
完整支持
10
Prefixed
|
Opera
完整支持
16
|
Safari 不支持 No | WebView Android 不支持 4.4 — 37 | Chrome Android 不支持 29 — 84 | Firefox Android 不支持 No |
Opera Android
完整支持
16
|
Safari iOS 不支持 No | Samsung Internet Android 完整支持 2.0 |
完整支持
不支持
要求使用供应商前缀或不同名称。