MDN self-hosted library · e01.org

CSSTransformComponent: is2D property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const translate = new CSSTranslate(CSS.px(10), CSS.px(20), CSS.px(30));

console.log(translate.is2D); // false
console.log(translate.toString()); // "translate3d(10px, 20px, 30px)"

translate.is2D = true;

console.log(translate.toString()); // "translate(10px, 20px)"
console.log(translate.z.toString()); // "30px" — z is still set, just ignored