translate3d() | CSS属性参考

917次阅读
没有评论

共计 436 个字符,预计需要花费 2 分钟才能阅读完成。

CSS translate3d()函数用于在 3D 空间中移动元素。

translate3d()函数的语法如下:

transform: translate3d(tx , ty, tz);

translate3d()函数用于在 3D 空间中移动元素。参数 tx 和 ty 可以是 <length> 值或 <percentage> 值。tz 值必须是 <length> 值,不能是 <percentage> 值。

参数为正值会使元素沿相应轴正方向移动,负数值会使元素沿相应轴的负方向移动。

示例代码:

transform: translate3d(100px, 100px, -200px);
transform: translate3d(50%, -100%, 1em);
transform: translate3d(-100px, -30px, 5vw);
浏览器支持

CSS3 3D Transform 的浏览器兼容性列表如下:

相关阅读
正文完
 0