The scale3d()
CSS function modifies the size of an element. Because the amount of scaling is defined by a vector, it can resize different dimensions at different scales.
This transformation is characterized by a vector whose coordinates define how much scaling is done in each direction. If all three coordinates of the vector are equal, the scaling is uniform, or isotropic, and the shape of the element is preserved. In that case, the scaling function defines a homothetic transformation.
When outside the [-1, 1]
range, the scaling enlarges the element in the direction of the coordinate; when inside the range, it shrinks the element in that direction. When equal to 1
it does nothing and when negative it performs a point reflection and the size modification.
scale3d(sx, sy, sz)
<number>
representing the abscissa of the scaling vector.<number>
representing the ordinate of the scaling vector.<number>
representing the z-component of the scaling vector.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. |
<p>foo</p> <p class="transformed">bar</p>
p { width: 50px; height: 50px; background-color: teal; } .transformed { transform: perspective(500px) scale3d(0.8, 2, 0.2) translateZ(100px); background-color: blue; }
<p>foo</p> <p class="transformed">bar</p>
p { width: 50px; height: 50px; background-color: teal; } .transformed { transform: scale3d(2, 3, 0); transform-origin: center; background-color: blue; }
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale3d