CSS - scaleZ()
The scaleZ()
CSS function modifies the z-coordinate of each element point by a constant factor, except if this scale factor is 1
, in which case the function is the identity transform. The scaling is not isotropic and the angles of the element are not conserved.
Examples
HTML
<p>foo</p> <p class="translated">bar</p> <p class="scaled">bar</p>
CSS
p { width: 50px; height: 50px; background-color: teal; } .translated{ /* Adding a perspective to create a 3d space */ transform: perspective(500px) translateZ(100px); } .scaled{ /* Adding a perspective to create a 3d space */ transform: perspective(500px) scaleZ(2) translateZ(100px); }
Result
Syntax
scaleZ(s)
Description
The scaleZ()
CSS function modifies the z-coordinate of each element point by a constant factor, except if this scale factor is 1
, in which case the function is the identity transform. The scaling is not isotropic and the angles of the element are not conserved.
scaleZ(sz)
is a shorthand for scale3d(1, 1, sz)
.
scaleZ(-1)
defines an axial symmetry along the z-axis passing by the origin (as specified by the transform-origin
property).
- s
- Is a
<number>
representing the scaling factor to apply on the z-coordinate of each point of the element.
Cartesian coordinates on ℝ2 | Homogeneous coordinates on ℝℙ2 | Cartesian coordinates on ℝ3 | Homogeneous coordinates on ℝℙ3 |
---|---|---|---|
This transform applies to the 3D space and cannot be represented on the plane. |
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/css/transform-function/scalez