CSS Typed Object Model API
The CSSTranslate() constructor creates a new CSSTranslate object representing the transform-function/translate value of the individual transform property in CSS.
Syntax
new CSSTranslate(x, y)
new CSSTranslate(x, y, z)
Parameters
- CSSTranslate.x
- : A value for the x-axis of the CSSTranslate object to be constructed. This must be a length-percentage.
- CSSTranslate.y
- : A value for the y-axis of the CSSTranslate object to be constructed. This must be a length-percentage.
- CSSTranslate.z
-
: A value for the z-axis of the CSSTranslate object to be constructed. This must be a length.
If a value is passed for the
z-axisthis is a 3D transform. The value ofis2Dwill be set to false.
-
Exceptions
- TypeError
- : Thrown if the value of
CSSTranslate.xorCSSTranslate.yis not a length-percentage, or if the value ofCSSTranslate.zexists but is not a length.
- : Thrown if the value of
Examples
To do
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
