CSS scaleZ() Function

The CSS scaleZ() function is used to scale elements in a three-dimensional space along the z-axis.

The scaleZ() function scales an element based on the number/s that you provide as an argument.

Here's an example of scaling an element using scaleZ(). Because it only scales along the z-axis, I've added some other transform functions in order to make the scale operation apparent. This has the effect of the image swinging out towards the viewer.

View Output

Removing transform-origin

In the previous example, I use transform-origin to adjust the origin of the transformation. Specifically, I use transform-origin: top; in order to exaggerate the effect of the scale operation on the x-axis.

The default origin for the rotation is 50% 50% (i.e. the center). Therefore, if we remove this property, the image will transform based on this value.

So here's an example of what the scale operation might look like when using the default transform-origin value.

View Output

Official Syntax

The official syntax of the scaleZ() function is as follows:

Possible Values

The scaleZ() function accepts number parameters that define the scaling vector for the scale operation.

A number is either an integer, or zero or more decimal digits followed by a dot (.) followed by one or more decimal digits and optionally an exponent composed of e or E and an integer.

CSS Specifications

Browser Support

The following table provided by Caniuse.com shows the level of browser support for this feature.