Scale(), scaleX(), scaleY() scaleZ() et scale3d() - Scaling CSS functions.
Summary of characteristics of the scale()
function
Description of scaling functions.
Description of the scaleX()
, scaleY()
and scaleZ()
functions.
Used with he transform
property, these functions define a change in the size of the element (enlarging or shrinking) along one of the axes.
The X axis is horizontal, Y is vertical, and the Z axis is perpendicular to the plane of the screen.
scaleZ()
has no visible effect on an element in the screen plane, as this function affects the thickness of the element (Z-axis).
Since the latter is equal to 0, multiplying it by any coefficient does not change anything.
But if the element is taken out of the screen plane by a translateZ()
function for example, the effect of scaleZ()
becomes visible.
transform-origin
can also make z-axis transformations visible by setting an origin outside the screen plane.
In any case, you also need to apply a perspective effect (with the perspective()
function) to see the effect of scaleZ()
.
See also the following pages:
transform
: the property that allows the transformations to be applied.transform-origin
: a property that defines the point that will remain fixed during a transformation. by default this point is located in the center of the element.
Description of the scale()
function.
The scale()
function replaces the scaleX()
and scaleY()
functions in a single write. It accepts two values or two percents.
Description of the scale3d()
function.
The scale3d()
function replaces the three functions scaleX()
, scaleY()
, and scaleZ()
in a single write
It accepts three values, which can also be percentages.
These fonctions can be used with:
transform
: Applies one or more geometric transformations (rotations, enlargements, etc.).
Syntax of these scaling functions.
- transform: scaleX(0.5); transform: scaleY(2); transform: scaleZ(1.5);
All three functions expect a value that can be a unitless number or a percentage. Percentages are calculated in relation to the original dimension of the element, in the corresponding direction: width for
scaleX()
, height forscaleY()
, and thickness forscaleZ()
.Negative values are accepted and cause the element to be flipped (symmetry).
transform:scaleX(0.5);
transform:scaleY(1.5);
transform:scaleZ(1.5);
transform-origin:center center -20px; transform:perspective(50px) scaleZ(1.5);
- transform: scale(0.7, 1); x y
x
andy
are the coefficients to be used to change the size of the element along the corresponding axis. If only one value is specified, it is applied along boththe X
andY
axis, This allows the proportions of the element to be preserved.These are two unitless numbers that are less than 1 (dimension reduction) or greater (magnification).
Percentages can be used and are evaluated against the corresponding original dimension.Negative values are accepted and cause the element to be flipped (symmetry).
transform:scale(0.7, 0.8);
- transform: scale3d(0.7, 0.8, 1.5); x y z
x
,y
andz
are the coefficients to be used to change the size of the element along the corresponding axis. All three values must be indicated.These are three unitless numbers that are less than 1 (dimension reduction) or greater than 1 (enlargement).
Percentages can be used and are evaluated against the corresponding original dimension.Negative values are accepted and cause the element to be flipped (symmetry).
transform:scale(0.7, 0.8, 1.5);
transform-origin:center center 20px; transform:perspective(50px) scale(0.7, 0.8, 1.5);
In the examples below, the fine-line rectangle represents the original dimensions of the element. The thick line rectangle is the element after it has been transformed.
Simulator.
The simulator also applies the transform-origin:center center 20px property;
and inserts the perspective(50px)
function
in the transform
property to make transformations along the Z-axis visible.
Compatibility and support for 2D or 3D transformations.
2D and 3D transformations are correctly handled by current browsers.
The scale()
function and its derivatives scaleX()
, scaleY()
, scaleZ()
are also well recognized.
the backface-visibility
property.scale()
, scaleX()
and scaleY()
functions which, when used with the transform
property, apply an enlarging or shrinking coefficient to an element.scale3d()
and scaleZ()
functions which, when used with the transform
property, apply a magnification or reduction coefficient even on the Z axis.Notes:
(1) Does not support 2D transformations on SVG elements. Use the transform
attribute instead.
(2) Internet Explorer does not support transform-style:preserve-3d
, thus limiting the nesting of animations.
transformations
transformations
scale()
function
scale3d()
function
Browsers on computers :
Mobile browsers :
Outdated or marginal browsers :

Internet Explorer

KaiOS Browser

Opéra Mobile

Opéra

Firefox pour Androïd

Samsung Internet

Chrome

Edge

Firefox

Androïd Brower

Chrome pour Androïd

Baidu Browser

QQ Browser

Safari

Safari sur IOS

UC Browser pour Androïd

Opéra mini
Historic of scaling functions.
-
CSS Transforms Module Level 1
First level of specification concerning 2D transformations.
Presentation of the different transformation functions includingscale()
,scaleX()
andscaleY()
.February 28, 2012Working Draft.February 14, 2019Candidate Recommendation. -
CSS Transforms Module Level 2
Level 2 of the Transforms specification, introducing 3D transformations.
AddedscaleZ()
andscale3d()
functions.
The 2D functionsscale()
,scaleX()
andscaleY()
now accept percentage values.March 03, 2020Working Draft.
See also, concerning transformations.
The CSS Transforms Module contains all the properties and functions related to CSS transformations.
The scale()
function is described in this module, along with all of the following:
Properties:





Functions:

