这篇翻译不完整。请帮忙从英语翻译这篇文章

这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

草案
本页尚未完工.

CSS 属性 translate 允许你单独指定 transforms 中的平移,并独立于 transform 属性。这可以更好地反映到典型的用户界面用法,并节省了在指定transform 值时必须记住的转换函数的确切顺序。

Syntax

/* Keyword values */
translate: none;

/* Single values */
translate: 100px;
translate: 50%;

/* Two values */
translate: 100px 200px;
translate: 50% 105px;

/* Three values */
translate: 50% 105px 5rem;

Values

Single length/percentage value
一个长度值或百分比表示X轴和Y轴使用一样的值进行二维上的平移。等同于translate() (2D 平移)函数指定单个值。
Two length/percentage values
两个长度值或百分比表示在二维上分别按照指定X轴和Y轴的值进行的平移。等同于translate() (2D 平移)函数指定两个值。
Three length/percentage values
三个长度值或百分比表示在三维上分别按照指定X轴、Y轴、Z轴的值进行的平移。等同于translate3d() (3D 平移)函数。
none
表示平移效果没有被应用。

Formal syntax

none | <length-percentage> [ <length-percentage> <length>? ]?

where
<length-percentage> = <length> | <percentage>

Examples

HTML

<div>
  <p class="translate">Translation</p>
</div>

CSS

* {
  box-sizing: border-box;
}

html {
  font-family: sans-serif;
}

div {
  width: 150px;
  margin: 0 auto;
}

p {
  padding: 10px 5px;
  border: 3px solid black;
  border-radius: 20px;
  width: 150px;
  font-size: 1.2rem;
  text-align: center;
}

.translate {
  transition: translate 1s;
}

div:hover .translate {
  translate: 200px 50px;
}

Result

 

Specifications

Specification Status Comment
CSS Transforms Level 2
individual transforms
Editor's Draft Initial definition.

初始值none
适用元素transformable elements
是否是继承属性
Percentagesrefer to the size of bounding box
适用媒体visual
计算值as specified, but with relative lengths converted into absolute lengths
Animation typea transform
正规顺序per grammar
Creates stacking contextyes

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Experimental
Chrome Full support YesEdge No support NoFirefox Full support 60
Disabled
Full support 60
Disabled
Disabled From version 60: this feature is behind the layout.css.individual-transform.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera No support NoSafari No support NoWebView Android Full support YesChrome Android Full support YesEdge Mobile No support NoFirefox Android Full support 60
Disabled
Full support 60
Disabled
Disabled From version 60: this feature is behind the layout.css.individual-transform.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android No support NoSafari iOS No support NoSamsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
User must explicitly enable this feature.
User must explicitly enable this feature.

文档标签和贡献者

此页面的贡献者: sunline.bucket
最后编辑者: sunline.bucket,