scaleY()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015.

scaleY()CSS関数で、要素を Y 軸に沿って (垂直に) 変倍する座標変換を定義します。結果は <transform-function> データ型になります。

試してみましょう

これは要素のそれぞれの点の横座標を一定の係数で修正しますが、係数が 1 である場合はこの関数が恒等変換になるので例外です。変倍は等方性ではなく、要素の角度は保存されません。 scaleY(-1)軸の線対称を定義し、水平軸は (transform-origin プロパティの指定通りに) 原点を通過します。

メモ: scaleY(sy)scale(1, sy) または scale3d(1, sy, 1) と等価です。

transform: rotateX(180deg); === transform: scaleY(-1);

構文

css
scaleY(s)

s

<number> で、要素のそれぞれの点の縦座標に適用する変倍係数を表します。

直交座標系 (ℝ^2) 同次座標系 (ℝℙ^2) 直交座標系 (ℝ^3) 同次座標系 (ℝℙ^3)
(1 0 0 s) (1 0 0 0 s 0 0 0 1) (1 0 0 0 s 0 0 0 1) (1 0 0 0 0 s 0 0 0 0 1 0 0 0 0 1)
[1 0 0 s 0 0]

HTML

html
<div>Normal</div>
<div class="scaled">Scaled</div>

CSS

css
div {
  width: 80px;
  height: 80px;
  background-color: skyblue;
}

.scaled {
  transform: scaleY(0.6);
  background-color: pink;
}

結果

仕様書

Specification
CSS Transforms Module Level 1
# funcdef-transform-scaley

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
scaleY()

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報