CKTIS / CSS
translate3d(): three coordinates, with different rules for depth
Move along X, Y and Z while separating percentage references, perspective projection and unchanged layout.
Version: CSS Modules
Syntax
transform: perspective(240px) translate3d(0, 0, 60px);translate3d(tx, ty, tz) requires three comma-separated components. X and Y accept lengths or percentages, resolved against the width and height of the transform reference box. Z accepts a length, including unitless zero, but no percentage because there is no corresponding percentage depth reference. In the usual CSS coordinate system, positive Z points toward the viewer.
Moving along Z does not by itself make a flat box larger. Perspective supplies that projection, and the order of the perspective and translation functions changes the result. Nested elements sharing a 3D scene may additionally require transform-style: preserve-3d. These are separate controls, not automatic effects of translate3d(). Rendering changes do not enlarge the normal-flow layout slot or guarantee hardware acceleration.
For an 80px by 40px box, translate3d(50%,25%,60px) produces the matrix vector 40,10,60 while the unprojected width and height remain 80.00 by 40.00. With perspective(240px) before the 60px depth translation, the recorded bounds grow to 106.67 by 53.33; reversing the functions leaves them 80.00 by 40.00. Layout remains 80px by 40px. The example rejects both a missing third component and a percentage Z value; it does not move the box onto or behind the perspective viewing plane.
Examples
const box=document.createElement('div');box.style.cssText='position:fixed;left:100px;top:100px;width:80px;height:40px;transform-origin:0 0;transform-box:border-box';document.body.append(box);
box.style.transform='translate3d(50%,25%,60px)';
const m=new DOMMatrix(getComputedStyle(box).transform);const plain=box.getBoundingClientRect();
box.style.transform='perspective(240px) translate3d(0,0,60px)';const projected=box.getBoundingClientRect();
box.style.transform='translate3d(0,0,60px) perspective(240px)';const reversed=box.getBoundingClientRect();
console.log('vector='+[m.m41,m.m42,m.m43]+'; plain='+plain.width.toFixed(2)+'x'+plain.height.toFixed(2));
console.log('projected='+projected.width.toFixed(2)+'x'+projected.height.toFixed(2)+'; reversed='+reversed.width.toFixed(2)+'x'+reversed.height.toFixed(2)+'; layout='+box.offsetWidth+'x'+box.offsetHeight);
console.log('missing-z='+CSS.supports('transform','translate3d(1px,2px)')+'; percent-z='+CSS.supports('transform','translate3d(0,0,50%)'));
box.remove();Result
vector=40,10,60; plain=80.00x40.00 projected=106.67x53.33; reversed=80.00x40.00; layout=80x40 missing-z=false; percent-z=false
The example uses a zero transform origin and a depth safely below the 240px perspective distance. Matrix coordinates are local; rendered bounds and layout dimensions answer different questions.