e01.org

`scaleX()` CSS function

The scaleX() CSS function defines a transformation that resizes an element along the x-axis (horizontally). Its result is a <transform-function> data type.

The **`scaleX()`** [CSS](/docs/Web/CSS) [function](/docs/Web/CSS/Reference/Values/Functions) defines a transformation that resizes an element along the
x-axis (horizontally). Its result is a <transform-function> data type.

CSS Demo: scaleX()

```css interactive-example-choice
transform: scaleX(1);
```

```css interactive-example-choice
transform: scaleX(0.7);
```

```css interactive-example-choice
transform: scaleX(1.3);
```

```css interactive-example-choice
transform: scaleX(-0.5);
```

```html interactive-example
<section id="default-example">
<img
class="transition-all"
id="example-element"
src="/shared-assets/images/examples/firefox-logo.svg"
width="200" />
</section>
```

It modifies the abscissa (horizontal, x-coordinate) of each element point by a constant factor, except when the scale factor is 1, in which case
the function is the identity transform. The scaling is not isotropic, and the angles of the element are generally not conserved, except for multiples of 90 degrees.
`scaleX(-1)` defines an [axial symmetry](https://en.wikipedia.org/wiki/Axial_symmetry), with a vertical axis passing through the origin (as specified by the transform-origin
property).

> [!NOTE]
> `scaleX(sx)` is equivalent to
> `scale(sx, 1)` or
> `scale3d(sx, 1, 1)`.

## Syntax

```css
scaleX(s)
```

### Values

- `s`
- : Is a &lt;number&gt; representing the scaling factor to apply on the abscissa (horizontal, x-coordinate) of each point of the
element.

<table class="standard-table">
<thead>
<tr>
<th scope="col"><a href="/en-US/docs/Web/CSS/Reference/Values/transform-function#cartesian_coordinates">Cartesian coordinates</a> on <a href="https://en.wikipedia.org/wiki/Real_coordinate_space">ℝ^2</a></th>
<th scope="col"><a href="https://en.wikipedia.org/wiki/Homogeneous_coordinates">Homogeneous coordinates</a> on <a href="https://en.wikipedia.org/wiki/Real_projective_plane">ℝℙ^2</a></th>
<th scope="col">Cartesian coordinates on <a href="https://en.wikipedia.org/wiki/Real_coordinate_space">ℝ^3</a></th>
<th scope="col">Homogeneous coordinates on <a href="https://en.wikipedia.org/wiki/Real_projective_space">ℝℙ^3</a></th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2">
<math display="block">
<semantics><mrow><mo>(</mo><mtable><mtr><mtd><mi>s</mi></mtd><mtd><mn>0</mn></mtd></mtr><mtr><mtd><mn>0</mn></mtd><mtd><mn>1</mn></mtd></mtr></mtable><mo>)</mo></mrow><annotation encoding="TeX">\left( \begin{array}{cc} s & 0 \\ 0 & 1 \end{array} \right)</annotation></semantics>
</math>
</td>
<td>
<math display="block">
<semantics><mrow><mo>(</mo><mtable><mtr><mtd><mi>s</mi></mtd><mtd><mn>0</mn></mtd><mtd><mn>0</mn></mtd></mtr><mtr><mtd><mn>0</mn></mtd><mtd><mn>1</mn></mtd><mtd><mn>0</mn></mtd></mtr><mtr><mtd><mn>0</mn></mtd><mtd><mn>0</mn></mtd><mtd><mn>1</mn></mtd></mtr></mtable><mo>)</mo></mrow><annotation encoding="TeX">\left( \begin{array}{ccc} s & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array} \right)</annotation></semantics>
</math>
</td>
<td rowspan="2">
<math display="block">
<semantics><mrow><mo>(</mo><mtable><mtr><mtd><mi>s</mi></mtd><mtd><mn>0</mn></mtd><mtd><mn>0</mn></mtd></mtr><mtr><mtd><mn>0</mn></mtd><mtd><mn>1</mn></mtd><mtd><mn>0</mn></mtd></mtr><mtr><mtd><mn>0</mn></mtd><mtd><mn>0</mn></mtd><mtd><mn>1</mn></mtd></mtr></mtable><mo>)</mo></mrow><annotation encoding="TeX">\left( \begin{array}{ccc} s & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array} \right)</annotation></semantics>
</math>
</td>
<td rowspan="2">
<math display="block">
<semantics><mrow><mo>(</mo><mtable><mtr><mtd><mi>s</mi></mtd><mtd><mn>0</mn></mtd><mtd><mn>0</mn></mtd><mtd><mn>0</mn></mtd></mtr><mtr><mtd><mn>0</mn></mtd><mtd><mn>1</mn></mtd><mtd><mn>0</mn></mtd><mtd><mn>0</mn></mtd></mtr><mtr><mtd><mn>0</mn></mtd><mtd><mn>0</mn></mtd><mtd><mn>1</mn></mtd><mtd><mn>0</mn></mtd></mtr><mtr><mtd><mn>0</mn></mtd><mtd><mn>0</mn></mtd><mtd><mn>0</mn></mtd><mtd><mn>1</mn></mtd></mtr></mtable><mo>)</mo></mrow><annotation encoding="TeX">\left( \begin{array}{cccc} s & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{array} \right)</annotation></semantics>
</math>
</td>
</tr>
<tr>
<td><code>[s 0 0 1 0 0]</code></td>
</tr>
</tbody>
</table>

## Formal syntax

## Examples

### 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;
}
```

### Result

200

## Specifications

## Browser compatibility

## See also

- [`scaleY()`](/docs/Web/CSS/Reference/Values/transform-function/scaleY)
- [`scaleZ()`](/docs/Web/CSS/Reference/Values/transform-function/scaleZ)
- transform
- scale
- &lt;transform-function&gt;
- transform-origin
- Other individual transform properties:
- translate
- rotate
- Note: there is no `skew` property

source: MDN Web Docs mirror · page

Cite this

"`scaleX()` CSS function". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/transform-function/scaleX

JSON record · API collection · citation policy