CSS scale Property
Change size of an element:
Definition and Usage
scale property allows you to change the size of elements.
scale 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 the
view a demo.
Note: An alternative technique to scale an element is to use CSS
transform property with CSS
scale() function. The CSS
scale property, as explained on this webpage, is arguably a simpler and more direct way to scale an element.
|Animatable:||yes. Read about animatable Try it|
The numbers in the table specify the first browser version that fully supports the property.
|x-axis||Defines scale factor at the x-axis. Possible values:
|y-axis||Defines scale factor at the y-axis. Possible values:
|z-axis||Defines scale factor at the z-axis. Possible values:
|initial||Sets this property to its default value. Read about initial|
|inherit||Inherits this property from its parent element. Read about inherit|
scale 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%;
CSS tutorial: CSS 2D Transforms
CSS tutorial: CSS 3D Transforms
CSS rotate property: CSS Rotate property
CSS translate property: CSS Translate property