All Topics
All Topics
Technology
Technology
AI
AI
Business
Business
Entertainment
Entertainment
News
News
Programming
Programming
Security
Security
Science
Science
Design
Design
Environment
Environment
Finance
Finance
Crypto
Crypto
Politics
Politics
Sports
Sports
Education
Education
Gaming
Gaming
Art
Art
Music
Music
Health
Health
Books
Books
Food
Food
Travel
Travel
Personal
Personal
Bluesky
Twitter

CSS translateZ(): Moving Elements Along the Z-Axis in 3D Space

By

Amit Sheen

10d ago· 4 min readen

Summary

A technical reference article explaining the CSS translateZ() function, which moves elements along the Z-axis in 3D space. It covers how translateZ() works in conjunction with perspective (either the perspective() function or the perspective CSS property), provides code examples and a live demo, and explains that without perspective, translateZ() has no visible effect. The article is part of CSS-Tricks' reference documentation on CSS transform functions.

Source

CSS-TricksCSS translateZ(): Moving Elements Along the Z-Axis in 3D Spacecss-tricks.com

Key quotes

· 3 pulled
The CSS translateZ() function adds depth to an element, drawing it closer or farther in space.
Either the perspective() function or perspective property is necessary for translateZ() to work. Without either one, there's no effect.
While it looks like the .box element is getting bigger, it's actually moving closer to the viewer.
Snippet from the RSS feed
The translateZ() function moves an element closer to or farther from the user.

You might also wanna read

CSS Implementation of Optical Illusions: Visual Perception Effects Created with Web Technologies

This article presents a collection of 50+ optical illusions created using CSS and HTML, demonstrating how visual perception tricks can be im

alvaromontoro.com·5mo ago

Building 3D Environments with HTML and CSS Transforms: Advanced Techniques for Lighting, Shadows and Collision Detection

A developer documents their experimental project creating a 3D environment using HTML elements and CSS transforms, featuring advanced techni

keithclark.co.uk·10mo ago

Implementing Spring and Bounce Animations with CSS's New Linear() Timing Function

The article explores the new CSS `linear()` timing function that enables physics-based animations like springs and bounces directly in nativ

joshwcomeau.com·8mo ago

Understanding CSS Stacking Contexts: How Elements Layer in Web Design

This article explains CSS stacking contexts - a fundamental CSS concept where elements are visually layered in three-dimensional space to cr

Smashing Magazine·5mo ago

Exploring Practical Uses for CSS Trigonometric Functions: sin() and cos()

This article examines CSS trigonometric functions (sin() and cos()) that were voted as the "Most Hated Feature" in the State of CSS 2025 sur

css-tricks.com·9mo ago

CSS Technique for True Shrinkwrapping Using Anchor Positioning and Scroll-Driven Animations

The article presents an innovative CSS technique for achieving true shrinkwrapping of elements with auto-wrapped content, which was previous

kizu.dev·4mo ago

Comments

Sign in to join the conversation.

No comments yet. Be the first.