Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Transforms, Transitions and Animations

The scale property

Reference for the CSS scale property: resize an element with its own property using one, two or three factors, mirror it with negatives, and animate it easily.

The scale property enlarges or shrinks an element by a factor. It is the standalone version of the scale() functions in transform, so you can scale something without rewriting a rotation or translation that lives elsewhere.

A factor of 1 means unchanged, 2 doubles the size and 0.5 halves it. Scaling grows from the transform-origin, by default the center. Layout is not affected, so neighbors do not move.

CSS
.thumb:hover {
  scale: 1.1;
}

Try it

Scale factors

Syntax

CSS
scale: none | [ <number> | <percentage> ]{1,3};
  • Initial value: none
  • Applies to: transformable elements
  • Inherited: no
  • Animatable: yes
  • Computed value: none, or a list of three numbers (x, y, z)

Values

Value Description
One value Scales width and height by the same factor.
Two values Separate horizontal and vertical factors.
Three values Horizontal, vertical and depth factors (z).
Percentage Same as the number divided by 100: 150% equals 1.5.
Negative number Mirrors the element along that axis, in addition to resizing.
none No scaling.

Usage notes

  • Everything scales. Borders, text, shadows and child elements grow with the box, unlike changing width and height.
  • Order of application. translate, then rotate, then scale, then transform.
  • Hover growth. Scaling is cheap to animate and does not cause reflow, but overlapping neighbors and a growing hit area can surprise users; leave breathing room.
  • Blur. Raster images and text may look soft when scaled up. For crisp results, start from a larger source and scale down.
  • Zero. scale: 0 makes the element invisible and, since a zero matrix cannot be inverted, unclickable. Animations that start from 0 are common for pop-in effects.
  • Side effects match transform: a stacking context and a containing block for fixed descendants.

Browser support

Individual transform properties are newer than transform. They work in current versions of the major browsers, but check a compatibility table for older ones.