CSS Portal

CSS scale Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The scale property controls the visual scaling of an element along one or more axes, changing its rendered size without altering its computed layout dimensions in the normal flow. Unlike changing width or height, applying scale adjusts the element’s coordinate system and the way it is painted - its children, borders and backgrounds are scaled together - while the surrounding layout typically remains as if the original size were unchanged. This makes scale particularly useful for visual effects, for temporarily enlarging or shrinking interface elements, and for performant animations where you want to avoid reflow.

Scaling can be uniform or non‑uniform and can operate in two or three dimensions; a uniform scale keeps all axes proportional, whereas a non‑uniform scale stretches or squashes an element along specific axes. Because scaling manipulates the element’s rendering transform, it interacts with the element’s transform origin (the point around which the scale is applied) and with any other transform operations that may be in effect. For the broader transform model and how multiple transform functions combine, see transform. To control the pivot for the transformation, see transform-origin.

When animating size changes, using scale is often preferable to animating layout properties because it avoids layout recalculation and can be GPU-accelerated, improving smoothness and reducing jank. For smooth state transitions where elements grow or shrink in response to interaction, scale pairs naturally with timing controls and easing functions provided by CSS animation systems; for guidance on animating property changes, see transition. Keep in mind visual considerations such as pixel sampling and stroke scaling: text and thin strokes may become blurred or thicker/thinner when scaled, so consider separate strategies (like changing font size or stroke width) when crispness is critical.

Finally, because scaling only affects the rendering layer, it can change hit-testing and the element’s visual overflow without changing how sibling elements are laid out. That can be leveraged to create overlays, popovers, or interactive feedback where the scaled element appears larger but does not push other content away. Also be aware that combining scaled transforms with other effects (perspective, 3D transforms, or complex stacking contexts) can change perceived depth and interaction, so test interactions and composition in context.

Definition

Initial value
none
Applies to
transformable elements
Inherited
no
Computed value
as specified
Animatable
a transform
JavaScript syntax
object.style.scale

Interactive Demo

front
back
right
left
top
bottom

Syntax

scale: none | x-axis y-axis z-axis

Values

  • noneSpecifies that no scaling should be applied.
  • x-axisDefines scale factor at the x-axis. Possible values: number, percentage
  • y-axisDefines scale factor at the y-axis. Possible values: number, percentage
  • z-axisDefines scale factor at the z-axis. Possible values: number, percentage

Example

<div class="container">
<div class="scaling-box">
Hover over me!
</div>
</div>
/* Basic styling for the container */
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 300px;
}

/* The element we want to scale */
.scaling-box {
  width: 150px;
  height: 150px;
  background-color: #3498db;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  
  /* 1. Define the transition for smooth scaling */
  transition: scale 0.3s ease-in-out;
}

/* 2. Apply the scale on hover */
.scaling-box:hover {
  /* scale:   */
  scale: 1.5; 
}

Browser Support

The following information will show you the current browser support for the CSS scale property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!