Favorites

scaleY() CSS Function

scaleY()
CSS FunctionThis function is supported by all modern browsers.
Updated 21st November 2026

The scaleY() transform function stretches or shrinks an element vertically. Negative values flip it upside down.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

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.

Interactive Demo

Transform
Demo Code
HTML Code
<div class="demo-area">
	<div class="demo-ghost"></div>
	<div class="demo-element">Transform</div>
</div>
CSS Code
.demo-area {
	position: relative;
	width: 300px;
	height: 190px;
	background: #f4f4f4;
	outline: 1px dashed #b0b0b0;
}
.demo-ghost, .demo-element {
	position: absolute;
	left: 100px;
	top: 55px;
	width: 100px;
	height: 80px;
	box-sizing: border-box;
}
.demo-ghost {
	border: 2px dashed #b0b0b0;
}
.demo-element {
	padding: 8px;
	background: rgb(247 37 133 / 85%);
	color: #fff;
	font-size: 14px;
	transform: scaleY(1);
}

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;
}
Open in editor

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
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.