Favorites

translate3d() CSS Function

translate3d()
CSS FunctionThis function is supported by all modern browsers.
Updated 21st November 2026

The translate3d() transform function moves an element along the X, Y and Z axes at once, such as translate3d(10px, 20px, 30px).

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

Description

The translate3d() CSS function is a powerful method used to move an element in three-dimensional space along the X, Y, and Z axes. Unlike its 2D counterpart translate(), translate3d() allows you to specify movement in the Z direction, giving elements a sense of depth when combined with transform properties and perspective settings. This function can be particularly useful for creating animations, transitions, and interactive UI effects that require a more immersive visual experience.

When using translate3d(), you provide three values: the first for horizontal movement (X-axis), the second for vertical movement (Y-axis), and the third for depth (Z-axis). Positive values move the element forward along the axis, while negative values move it backward. The units can be pixels, percentages, or other CSS length units. Movement along the Z-axis is most effective when combined with perspective, which allows the browser to render the element with realistic depth.

For example, applying translate3d(50px, 100px, 30px) to a div would move it 50 pixels to the right, 100 pixels down, and 30 pixels toward the viewer. Animations using translate3d() are often more performant than animating left or top properties, because they leverage the GPU for smoother transitions.

Another common use case is combining translate3d() with rotate3d() or scale3d() to create complex 3D transformations, such as flipping cards or simulating a 3D carousel. This makes it a versatile tool for modern web design where depth and motion are desired.

Example usage:

.card {
  transform: translate3d(20px, 40px, 50px);
  transition: transform 0.5s ease-in-out;
}

This would smoothly move the element along all three axes over half a second when the transformation is applied.

Interactive Demo

Transform
Demo Code
HTML Code
<div class="demo-area">
	<div class="demo-ghost"></div>
	<div class="demo-element">Transform</div>
</div>
CSS Code
.demo-area {
	position: relative;
	width: 300px;
	height: 190px;
	background: #f4f4f4;
	outline: 1px dashed #b0b0b0;
}
.demo-ghost, .demo-element {
	position: absolute;
	left: 100px;
	top: 55px;
	width: 100px;
	height: 80px;
	box-sizing: border-box;
}
.demo-ghost {
	border: 2px dashed #b0b0b0;
}
.demo-area {
	perspective: 500px;
}
.demo-element {
	padding: 8px;
	background: rgb(247 37 133 / 85%);
	color: #fff;
	font-size: 14px;
	transform: translate3d(0, 0, 0);
}

Syntax

transform: translate3d( tx, ty, tz);

Values

  • txHorizontal shift. A positive value shifts to the right, a negative value to the left.
  • tyVertical shift. A positive value moves down, a negative value up.
  • tzA positive value moves the element towards the viewer, and a negative value farther away.
Any length units accepted in CSS are accepted as values - for example, pixels (px), inches (in), points (pt), etc. For tz, a positive value moves the element toward the viewer and a negative value away. A value of 0 does not change the position of the element.

Example

<div class="scene">
<div class="card">
3D Translate
</div>
</div>
/* The parent container provides the 3D context */
.scene {
width: 200px;
height: 200px;
perspective: 600px;
margin: 50px;
}

/* The element we are moving */
.card {
width: 100%;
height: 100%;
background-color: #3498db;
color: white;
display: flex;
align-items: center;
justify-content: center;
font-family: sans-serif;
font-weight: bold;
border-radius: 10px;
transition: transform 0.5s ease; /* Smooths the movement */
}

/* When hovering over the scene, move the card:
X: 50px (right)
Y: 20px (down)
Z: 100px (toward the user)
*/
.scene:hover .card {
transform: translate3d(50px, 20px, 100px);
background-color: #2ecc71;
}
Open in editor

Browser Support

The following information will show you the current browser support for the CSS translate3d() function. Hover over a browser icon to see the version that first introduced support for this CSS function.

This function is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.