dimension
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
<dimension>
CSS 数据类型是一个带有单位的<number>
,例如:10px
CSS 使用度量值来描述距离 (<length>
),时间 (<time>
),频率 (<frequency>
),分辨率 (<resolution>
) 以及其他量。
格式
<dimension>
的格式是一个<number>
后紧随一个是标记符的单位,单位大小写不敏感。
Examples
合法的度量值
12px 12 像素 1rem 1 rem 1.2pt 1.2 点 2200ms 2200 毫秒 200hz 200 赫兹 200Hz 200 赫兹 (单位大小写不敏感)
非法的度量值
12 px 单位必须紧随数字,不能有空格 12"px" 单位是标识符,不能加引号
规范
Specification |
---|
CSS Values and Units Module Level 4 # dimensions |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
<dimension> |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.