CSS scale3d() Function
The CSS scale3d() function is used within the
transform property, and defines a 3D scaling of
an element along the x, y, and z-axes at a given degree.
Note: To activate a 3D space, the element needs perspective. Without perspective, any 3D transforms will look flat and two-dimensional.
Example
Use scale3d() to scale several <div> elements:
.container {
perspective: 500px; /* Creates the 3D space */
}
.box1 {
transform: scale3d(0.8, 0.8, 0.8);
}
.box2 {
transform: scale3d(-0.5, -0.5, -0.5);
}
.box3 {
transform:
scale3d(1.1, 1.2, 1);
}
Try it Yourself »
More "Try it Yourself" examples below.
Browser Support
The numbers in the table specify the first browser version that fully supports the function.
| Function | |||||
|---|---|---|---|---|---|
| scale3d() | 12 | 12 | 10 | 4 | 15 |
CSS Syntax
scale3d(sx, sy, sz)
| Value | Description |
|---|---|
| sx | A positive or negative number that defines the scaling vector for the width |
| sy | A positive or negative number that defines the scaling vector for the height |
| sz | A positive or negative number that defines the scaling vector for the z direction |
| Version: | CSS Transforms Module Level 2 |
|---|
More Examples
Example
Use scale3d() to scale images:
.container {
perspective: 500px; /* Creates the 3D space */
}
.img1 {
transform: scale3d(0.8, 0.8, 0.8);
}
.img2 {
transform: scale3d(-0.5, -0.5, -0.5);
}
.img3 {
transform: scale3d(1.1, 1.1, 1);
}
Try it Yourself »
Related Pages
CSS reference: CSS transform property.
CSS reference: CSS perspective property.
CSS reference: CSS rotate3d() function.
CSS reference: CSS rotateX() function.
CSS reference: CSS rotateY() function.
CSS reference: CSS rotateZ() function.
CSS tutorial: CSS 3D transforms.