The translate property moves an element horizontally, vertically, or in 3D — without changing its place in the document flow. It is ideal for hover lifts, badges, and centering overlays.
01
Move X/Y
Shift position.
02
Units
px, %, rem.
03
No layout shift
Visual only.
04
Hover lift
UI micro-motion.
05
Centering
-50% pattern.
06
vs transform
Standalone prop.
Fundamentals
Introduction
The translate property in CSS is used to move an element from its current position, both horizontally and vertically. It is part of the CSS transform family, which allows developers to manipulate elements in 2D and 3D space without affecting the layout of the document.
Definition and Usage
Use translate when you need to reposition an element visually — for example, nudging a badge, lifting a card on hover, or centering a modal. Pair it with transition for smooth animated movement.
💡
Beginner Tip
You may also see transform: translate(50px, 20px) in older examples. The standalone translate property does the same kind of movement and is easier to animate independently.
Foundation
📝 Syntax
The syntax for the translate property is as follows:
syntax.css
element{translate:tx ty tz;}
tx — horizontal translation (X axis)
ty — vertical translation (Y axis)
tz — optional depth translation (Z axis) for 3D
Basic Example
translate.css
.box{translate:50px 20px;}
Syntax Rules
One value sets X only; two values set X and Y; three values add Z.
Length units include px, em, rem, and %.
Percentages are relative to the element’s own size (border box).
Default is none (no movement).
The property is not inherited.
Related Properties
transform — shorthand that can include translate(), rotate(), scale()
rotate — standalone rotation property
scale — standalone scaling property
transition — animate translate changes smoothly
transform-origin — pivot point for transforms
Defaults
🎯 Default Value
The default value is none, which means no translation — the element stays in its original visual position.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Default value
none
Move right and down
translate: 50px 20px;
Move horizontally only
translate: 40px;
Center overlay
translate: -50% -50%;
Hover lift
translate: 0 -8px;
Inherited
No
Reference
💎 Property Values
The translate property accepts length and percentage values.
Value
Example
Description
none
translate: none;
No translation is applied.
tx
translate: 50px;
A length value (px, em, rem, %, etc.) specifying the horizontal translation.
ty
translate: 0 20px;
A length value specifying the vertical translation when two values are provided.
tz
translate: 0 0 10px;
Optional third value for depth along the Z axis in 3D contexts.
50px 20px40px 00 -8px-50% -50%
Context
When to Use translate
translate is ideal for visual repositioning without changing layout:
Hover lifts — Move cards or buttons slightly on hover with translate: 0 -8px.
Badges and labels — Nudge small elements relative to text or icons.
Centering overlays — Combine with top: 50%; left: 50% and translate: -50% -50%.
Slide-in panels — Animate from off-screen with transitions on translate values.
Preview
👀 Live Preview
The dashed box shows the original space; the blue box is shifted with translate: 36px 12px:
Visual shift, layout unchanged
Hands-On
Examples Gallery
In this example, we’ll translate a div element horizontally and vertically using the translate property.
📜 Core Patterns
Move elements with one or two translate values on the X and Y axes.
Example 1 — Basic horizontal and vertical move
In this example, we’ll translate a div element horizontally and vertically using the translate property.
Screen readers — translate is visual only; do not rely on it to convey semantic state changes.
Companion
translate + transition
Animate translate for smooth hover lifts and slide effects. It performs better than animating top, left, or margin because it does not trigger layout reflow.
The browser places the element in normal document flow.
Layout
2
translate is applied
X, Y, and optional Z values shift the painted appearance.
Transform
3
Layout space stays put
Sibling elements behave as if the box were not moved.
No reflow
=
✅
Visual repositioning
The element appears moved without disrupting page layout.
Compatibility
Browser Compatibility
The translate property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It is part of the CSS transform module, which has excellent support across all major browsers.
✓ Modern browsers · Widely supported
Standalone translate property
The individual translate property works in current Chrome, Firefox, Safari, and Edge. Older code may use transform: translate() instead.
96%Browser support
Google Chrome104+ · Desktop & Mobile
Full support
Mozilla Firefox72+ · Desktop & Mobile
Full support
Apple Safari14.1+ · macOS & iOS
Full support
Microsoft Edge104+ · All versions
Full support
Opera90+ · All versions
Full support
Testing tip
For very old browsers, fall back to transform: translate(). The visual result is the same; only the property name differs.
translate property96% supported
Bottom line:translate is reliable in modern browsers; use transform: translate() as a fallback if needed.
Wrap Up
Conclusion
The translate property is essential for creating smooth and interactive web experiences by moving elements dynamically on the page.
It is widely supported and offers a straightforward way to manipulate the position of elements without affecting their layout properties. Experiment with different values for tx and ty to achieve the desired visual effects in your web projects.
Use translate instead of top/left for animated movement
Pair with transition for smooth hover effects
Use -50% -50% for centering positioned overlays
Prefer small pixel values for subtle UI feedback
Respect prefers-reduced-motion: reduce
❌ Don’t
Use translate to fix layout problems — use flexbox or grid instead
Assume translated content is removed from the accessibility tree
Move critical information far off-screen with translate
Forget that layout space is unchanged after translating
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about translate
Use these points when moving elements with CSS.
5
Core concepts
↔01
Move X/Y
Visual shift.
Purpose
🕐02
none
Default value.
Default
📚03
No reflow
Layout stays.
Behavior
📈04
Percentages
Center pattern.
Values
⚡05
+ transition
Smooth motion.
Pattern
❓ Frequently Asked Questions
translate moves an element from its normal position along the X, Y, and optionally Z axes without changing document flow.
The default is none, which means no translation is applied.
translate is a standalone property for movement only. transform: translate() is a function inside the transform shorthand that can be combined with rotate, scale, and other functions.
No. translate creates a visual shift only. The element still occupies its original layout space.
No, translate is not inherited. Each element sets its own translation.