CSS Portal

scaleY() CSS Function

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

Description

The scaleY() CSS function is a transform function that allows you to scale an element along its vertical axis. When applied, it stretches or compresses the element in the y-direction while keeping its horizontal dimension unchanged. A value of 1 represents the element’s original height, values greater than 1 increase the height, and values between 0 and 1 decrease it. Negative values can flip the element vertically.

This function is often used in combination with other transform functions such as scaleX(), rotate(), or translate() to create more complex transformations. It is applied via the transform property and can be animated with the transition property for smooth visual effects.

For example, if you want a div to appear as if it is growing taller on hover, you could use:

div {
  transform: scaleY(1);
  transition: transform 0.3s ease;
}

div:hover {
  transform: scaleY(1.5);
}

In this case, the div smoothly stretches to 1.5 times its original height when hovered. This technique is commonly used for effects such as dropdown menus, accordion panels, or interactive visualizations where vertical expansion or contraction is desired.

The function is hardware-accelerated in modern browsers, making it efficient for animations compared to directly modifying the height property.

Syntax

scaleY() = transform: scaleY(<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 vertically;
    - a value of 1 leaves the element size unchanged and does not give a visible effect.

Example

<body>

<div class="container">
<div class="box original">Original</div>
<div class="box scaled">Scaled (2x Height)</div>
</div>

</body>
/* Basic styling for visibility */
.container {
display: flex;
gap: 50px;
padding: 50px;
font-family: sans-serif;
}

.box {
width: 150px;
height: 100px;
background-color: #3498db;
color: white;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid #2980b9;
}

/* The scaleY transformation */
.scaled {
background-color: #e74c3c;
border-color: #c0392b;

/* This doubles the height vertically */
transform: scaleY(2);

/* Optional: helps see where the scaling starts from */
transform-origin: center;
}

Browser Support

The following information will show you the current browser support for the CSS scaleY() 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
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 31st December 2025

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