- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Selectors
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Border Block
- CSS - Border Inline
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursor
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS - Inline Block
- CSS - Dropdowns
- CSS - Visibility
- CSS - Overflow
- CSS - Clearfix
- CSS - Float
- CSS - Arrows
- CSS - Resize
- CSS - Quotes
- CSS - Order
- CSS - Position
- CSS - Hyphens
- CSS - Hover
- CSS - Display
- CSS - Focus
- CSS - Zoom
- CSS - Translate
- CSS - Height
- CSS - Hyphenate Character
- CSS - Width
- CSS - Opacity
- CSS - Z-Index
- CSS - Bottom
- CSS - Navbar
- CSS - Overlay
- CSS - Forms
- CSS - Align
- CSS - Icons
- CSS - Image Gallery
- CSS - Comments
- CSS - Loaders
- CSS - Attr Selectors
- CSS - Combinators
- CSS - Root
- CSS - Box Model
- CSS - Counters
- CSS - Clip
- CSS - Writing Mode
- CSS - Unicode-bidi
- CSS - min-content
- CSS - All
- CSS - Inset
- CSS - Isolation
- CSS - Overscroll
- CSS - Justify Items
- CSS - Justify Self
- CSS - Tab Size
- CSS - Pointer Events
- CSS - Place Content
- CSS - Place Items
- CSS - Place Self
- CSS - Max Block Size
- CSS - Min Block Size
- CSS - Mix Blend Mode
- CSS - Max Inline Size
- CSS - Min Inline Size
- CSS - Offset
- CSS - Accent Color
- CSS - User Select
- CSS Advanced
- CSS - Grid
- CSS - Grid Layout
- CSS - Flexbox
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Paged Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS - Image Sprites
- CSS - Important
- CSS - Data Types
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS - Rounded Corner
- CSS - Border Images
- CSS - Multi Background
- CSS - Color
- CSS - Gradients
- CSS - Box Shadow
- CSS - Box Decoration Break
- CSS - Caret Color
- CSS - Text Shadow
- CSS - Text
- CSS - 2d transform
- CSS - 3d transform
- CSS - Transition
- CSS - Animation
- CSS - Multi columns
- CSS - Box Sizing
- CSS - Tooltips
- CSS - Buttons
- CSS - Pagination
- CSS - Variables
- CSS - Media Queries
- CSS - Functions
- CSS - Math Functions
- CSS - Masking
- CSS - Shapes
- CSS - Style Images
- CSS - Specificity
- CSS - Custom Properties
- CSS Responsive
- CSS RWD - Introduction
- CSS RWD - Viewport
- CSS RWD - Grid View
- CSS RWD - Media Queries
- CSS RWD - Images
- CSS RWD - Videos
- CSS RWD - Frameworks
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
CSS Function - translate3d()
The translate3d() function in CSS is used to translate, or move, an element in three-dimensional space. The result is a <transform-function> datatype.
The translate3d() function results in the transformation, based on the three-dimensional vector [tx, ty, tz]. The coordinates value determine the direction in which the element will move.
Possible values
The function translate3d() takes the following values as parameter(s).
tx: Can be a <length> or <percentage> value that represents the abscissa (horizontal, x-component) of the translating vector [tx, ty, tz].
ty: Can be a <length> or <percentage> value that represents the ordinate (vertical, y-component) of the translating vector [tx, ty, tz].
tz: Can only be a <length> value that represents z-component of the translating vector [tx, ty, tz]. It can not have a <percentage> value and if given the property containing the transform will be invalid.
Syntax
transform: translate3d(tx, ty, tz);
CSS translate3d() - Length Value
Following is an example of translate3d() function with the various ways in which length values can be passed to it, i.e., positive and negative values:
<html> <head> <style> #container { border: 5px solid black; margin: 25px; } #sample { height: 110px; width: 110px; border: 2px solid black; } .translate-3d-length { transform: translate3d(20px, 30px, 20px); background-color: yellowgreen; } .translate-3d-negative { transform: translate(-20px, -10px, -30px); background-color: tomato; } </style> </head> <body> <div id="container"> <div id="sample" style="background-color: lightyellow;">no translate() applied</div> <div class="translate-3d-length" id="sample">translate3d(20px, 30px, 20px)</div> <div class="translate-3d-negative" id="sample">translate3d(-20px, -10px, -30px)</div> </div> </body> </html>
CSS translate3d() - Combining x-axis and z-axis values
Following is an example of translate3d() function with length values passed to x-axis and z-axis:
<html> <head> <style> #container { border: 5px solid black; margin: 25px; } #sample { height: 110px; width: 110px; border: 2px solid black; } .translate-3d-length { transform: translate3d(20px, 0, 20px); background-color: yellowgreen; } </style> </head> <body> <div id="container"> <div id="sample" style="background-color: lightyellow;">no translate3d()</div> <div class="translate-3d-length" id="sample">translate3d(20px, 0, 20px)</div> <div id="sample" style="background-color: lightyellow;">no translate3d()</div> </div> </body> </html>
CSS translate3d() - Combining y-axis and z-axis values
Following is an example of translate3d() function with length values passed to y-axis and z-axis, along with perspective() value:
<html> <head> <style> #container { border: 5px solid black; margin: 25px; } #sample { height: 110px; width: 110px; border: 2px solid black; } .translate-3d-length { transform: perspective(580px) translate3d(0, 30px, 50px); background-color: yellowgreen; } </style> </head> <body> <div id="container"> <div id="sample" style="background-color: lightyellow;">no translate3d()</div> <div class="translate-3d-length" id="sample">translate3d(0, 30px, 50px)</div> <div id="sample" style="background-color: lightyellow;">no translate3d()</div> </div> </body> </html>