scaleX()

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.

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

試してみましょう

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

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

構文

css
scaleX(s)

s

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

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

HTML

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

CSS

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

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

結果

仕様書

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

ブラウザーの互換性

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
scaleX()

Legend

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

Full support
Full support

関連情報