scaleX() CSS Function
Description
The scaleX() CSS function is used to scale an element horizontally along the X-axis. It is part of the broader transform family of functions, allowing developers to modify the size and orientation of elements without affecting their position in the document flow. When applied, scaleX() multiplies the element's width by a specified factor, where a value of 1 keeps the width unchanged, values greater than 1 expand it, and values between 0 and 1 shrink it. Negative values can also be used to flip the element horizontally.
This function works seamlessly with other transform functions like scaleY() or rotate(), enabling complex transformations. It does not alter the element’s width property directly, meaning the layout space it occupies remains the same unless combined with properties like transform-origin to control the pivot point of scaling.
A practical example would be animating a button on hover to give a subtle stretching effect:
button {
transition: transform 0.3s ease;
}
button:hover {
transform: scaleX(1.2);
}
In this example, the button grows 20% wider when hovered over, enhancing interactivity without affecting surrounding elements. This function is often used in combination with scaleY() for uniform scaling or with translate() functions to achieve dynamic visual effects.
Syntax
scaleX() = transform: scaleX(<number>);
Values
- <number>The value is a positive or negative number.
- a value greater than 1 (for example: 1.5) increases the scale;
- a value less than 1 (for example: 0.8) reduces the scale;
- a negative value (for example: -1) mirrors the element horizontally;
- a value of 1 leaves the element size unchanged and does not give a visible effect.
Example
Browser Support
The following information will show you the current browser support for the CSS scaleX() function. Hover over a browser icon to see the version that first introduced support for this CSS function.
This function is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 31st December 2025
