此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

transform-box

基线 广泛可用 *

自 2020年1月 起,此特性已在主流浏览器中得到支持,可在大多数设备和浏览器版本中正常使用。

* 此特性的某些部分的支持程度可能有所不同。

transform-box 属性定义了与 transformtransform-origin 这两个属性有关联的布局框。

语法

css
/* Keyword values */
transform-box: border-box;
transform-box: fill-box;
transform-box: view-box;

/* Global values */
transform-box: inherit;
transform-box: initial;
transform-box: unset;

transform-box属性被指定为以下所列出的关键字值之一。

border-box

border box 是用作引用框,一个表格(table)的 border-box 是 table 包装盒的边框,而不是表的边框。

fill-box

Uses the object bounding box as reference box.

view-box

Uses the nearest SVG viewport as reference box. If a viewBox attribute is specified for the SVG viewport creating element, the reference box is positioned at the origin of the coordinate system established by the viewBox attribute and the dimension of the reference box is set to the width and height values of the viewBox attribute.

形式定义

初始值view-box
适用元素可变换元素
是否是继承属性
计算值as specified
动画类型离散值

形式语法

transform-box = 
content-box |
border-box |
fill-box |
stroke-box |
view-box

规范

规范
CSS Transforms Module Level 1
# transform-box

浏览器兼容性

参见