CSS scaleY() Function

Hàm scaleY() là một hàm dựng sẵn dùng để thay đổi kích thước phần tử. Hàm này thay đổi kích thước theo trục y trên mặt phẳng 2D. Nó mở rộng hoặc thu hẹp các phần tử theo chiều dọc.

Cú pháp:

scaleY( y )

Tham số: Hàm này chấp nhận một tham số duy nhất là y. Tham số này giữ hệ số tỷ lệ dọc theo trục y. Các ví dụ sau minh họa hàm scaleY() trong CSS:

Ví dụ 1:

html
<!DOCTYPE html> 
<html> 

<head> 
    <title>CSS scaleY() function</title> 

    <style> 
        body {
            text-align:center;
        }
        h1 {
            color:green;
        }
        .scaleY_image {
            transform: scaleY(1.5);
        }
    </style> 
</head> 

<body> 
    <h1>GeeksforGeeks</h1>
    <h2>CSS scaleY() function</h2>
    <br><br>

    <img class="scaleY_image" src= 
"https://media.geeksforgeeks.org/wp-content/cdn-uploads/20190710102234/download3.png"
        alt="GeeksforGeeks logo"> 
</body> 
</html>

Đầu ra:

 css-scaley-function 

Ví dụ 2:

html
<!DOCTYPE html> 
<html> 

<head> 
    <title>CSS scaleY() function</title> 

    <style> 
        body {
            text-align:center;
        }
        h1 {
            color:green;
        }
        .GFG {
            font-size:35px;
            font-weight:bold;
            color:green;
            transform: scaleY(2);
        }
    </style> 
</head> 

<body> 
    <h1>GeeksforGeeks</h1>
    <h2>CSS scaleY() function</h2>

    <div class="GFG">Welcome to GeeksforGeeks</div> 
</body> 
</html>

Đầu ra:

 css-scaley-function 

Trình duyệt được hỗ trợ: Dưới đây là danh sách các trình duyệt hỗ trợ hàm scaleY().

  • Google Chrome 1 trở lên
  • Edge 12 trở lên
  • Internet Explorer 9 trở lên
  • Firefox 3.5 trở lên
  • Safari 3.1 trở lên
  • Opera 10.5 trở lên

Last Updated : 21/07/2025