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.

## Syntax

scale3d(sx,sy,sz)

## Values

*sx*- Is a
`<number>`

representing the abscissa of the scaling vector. *sy*- Is a
`<number>`

representing the ordinate of the scaling vector. *sz*- Is a
`<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. | $\left(\begin{array}{cc}sx0& 0\\ 0sy& 0\\ 0& 0& sz\end{array}\right)$ | $\left(\begin{array}{ccc}sx0& 0& 0\\ 0sy& 0& 0\\ 0& 0& sz& 0\\ 0& 0& 0& 1\end{array}\right)$ |

## Examples

### Without changing the origin

#### HTML

<p>foo</p> <p class="transformed">bar</p>

#### CSS

p { width: 50px; height: 50px; background-color: teal; } .transformed { transform: perspective(500px) scale3d(0.8, 2, 0.2) translateZ(100px); background-color: blue; }

#### Result

### Translating the origin of the transformation

#### HTML

<p>foo</p> <p class="transformed">bar</p>

#### CSS

p { width: 50px; height: 50px; background-color: teal; } .transformed { transform: scale3d(2, 3, 0); transform-origin: center; background-color: blue; }