translate()
描述
translate() CSS 函数将元素相对于原 始位置水平和垂直移动给定值。
语法
css
transform: translate(tx [, ty]?);
/* the question mark indicates the second value is optional */值
- tx 水平移动。正值向右移动,负值向左移动。
- ty 垂直移动。正值向上移动,负值向下移动。如果未指定该值,则默认值为 0,并且不会发生垂直移位。
CSS 中接受的任何长度单位都被接受为值 - 例如,像素 (px)、英寸 (in)、点 (pt) 等。一个值仅水平移动元素,两个值水平移动元素并垂直独立。值 0 不会更改元素的位置。
