Saturday, December 5, 2026Sat, Dec 5 AboutRSSSubscribe

GDS

Design tools and creative technology

Code & Web

translate3d()

The translate3d function moves elements in 3D space, according to CSS-Tricks. It is used for creating depth and improving animation performance.

Original reporting · css-tricks.com

Read “translate3d()” at CSS-Tricks →

How this was written. GDS wrote this article with a language model from CSS-Tricks’s reporting (model: @cf/meta/llama-3.3-70b-instruct-fp8-fast); it describes that reporting rather than adding to it. The original, linked above, is the full story.

Key points from CSS-Tricks’s report

  • The translate3d function moves elements in 3D space along the X, Y, and Z axes.
  • It is used with the transform property and is defined in the CSS Transforms Module Level 2 specification.
  • The function takes three arguments: tx, ty, and tz, which represent the amount to translate the element along each axis.
  • It is often preferred because it forces the browser to composite the element on the GPU, improving animation performance.
  • The perspective property is necessary to create a sense of depth when moving an element along the Z axis.

The translate3d function is a CSS transform function that moves an element in a three-dimensional space along the X, Y, and Z axes. CSS-Tricks reported that it is the 3D counterpart to the translate function and is the best way to move an element when depth is desired.

The function is used with the transform property and is defined in the CSS Transforms Module Level 2 specification. It takes three arguments: tx, ty, and tz, which represent the amount to translate the element along the x-axis, y-axis, and z-axis, respectively.

The tx argument accepts length or percentage values, relative to the element's width, and moves the element horizontally. The ty argument also accepts length or percentage values, relative to the element's height, and moves the element vertically. The tz argument only accepts length values and moves the element along the z-axis, creating depth.

Compared to other translate functions, translate3d is the explicit three-axis version and is often preferred because it forces the browser to composite the element on the GPU, improving animation performance. CSS-Tricks noted that this is especially useful when one or two arguments are 0.

Moving an element along the Z axis has no effect without the perspective property applied to the element's parent. The perspective property creates a sense of depth and distance between the viewer and the screen. A small perspective value creates an intense depth effect, while a large value creates a subtle effect.

The translate3d function can be used to animate elements along the Z axis, creating a sense of depth and parallax effects. It can also be used to improve performance by promoting an element to its own composite layer, making animation smoother. However, modern browsers are smart enough that this trick is not always necessary, and overusing translate3d can waste memory.

The function can be combined with other 3D transforms, such as rotate3d and scale3d, to create full 3D compositions. The order of transform functions matters, as they are rendered in order from right to left.

Questions and answers

What is the translate3d function?

The translate3d function is a CSS transform function that moves an element in a three-dimensional space along the X, Y, and Z axes.

Why is the perspective property necessary?

The perspective property is necessary to create a sense of depth when moving an element along the Z axis, as it creates distance between the viewer and the screen.

Can the translate3d function be combined with other 3D transforms?

Yes, the translate3d function can be combined with other 3D transforms, such as rotate3d and scale3d, to create full 3D compositions.

Read the full story at CSS-Tricks More from Friday, December 4, 2026’s edition