CSSscale Property
Definition and Usage
Thescale property allows you to change the size of elements.
Thescale property defines values for how much an element is scaled in x- and y-directions. You can also define how much an element is scaled in z-direction.
Scale values can be given as one value, two values, or three values.
- If one value is given, the element is scaled the same amount in both x- and y-direction.
- If two values are given, the element is scaled in x- and y-direction individually.
- If three values are given, the element is scaled in x-, y- and z-direction individually.
To better understand thescale property,view a demo.
Note: An alternative technique to scale an element is to use CSStransform property with CSSscale() function. The CSSscale property, as explained on this webpage, is arguably a simpler and more direct way to scale an element.
| Default value: | none |
|---|---|
| Inherited: | no |
| Animatable: | yes.Read aboutanimatableTry it |
| Version: | CSS3 |
| JavaScript syntax: | object.style.scale="2 0.7"Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
| Property | |||||
|---|---|---|---|---|---|
| scale | 104 | 104 | 72 | 14.1 | 90 |
CSS Syntax
Property Values
| Property Value | Description | Demo |
|---|---|---|
| x-axis | Defines scale factor at the x-axis. Possible values:
| Demo ❯ |
| y-axis | Defines scale factor at the y-axis. Possible values:
| Demo ❯ |
| z-axis | Defines scale factor at the z-axis. Possible values:
| |
| initial | Sets this property to its default value.Read aboutinitial | |
| inherit | Inherits this property from its parent element.Read aboutinherit |
More Examples
Example
Whenscale property is set with two values, the size is set on x-axis and y-axis individually. Here, the element becomes double in size on x-axis and half the size on y-axis:
scale: 2 50%;
}
Related Pages
CSS tutorial:CSS 2D Transforms
CSS tutorial:CSS 3D Transforms
CSS rotate property:CSS Rotate property
CSS translate property:CSS Translate property

