---
title: skew()
slug: Web/CSS/transform-function/skew()
tags:
  - CSS
  - CSS Function
  - CSS Transforms
  - Function
  - Reference
browser-compat: css.types.transform-function.skew
---
{{CSSRef}}

The **`skew()`** [CSS](/en-US/docs/Web/CSS) [function](/en-US/docs/Web/CSS/CSS_Functions) defines a transformation that skews an element on the 2D
plane. Its result is a {{cssxref("&lt;transform-function&gt;")}} data type.

{{EmbedInteractiveExample("pages/css/function-skew.html")}}

This transformation is a shear mapping ({{interwiki('wikipedia', 'Shear_mapping', 'transvection')}}) that distorts
each point within an element by a certain angle in the horizontal and vertical directions. The effect is as if you
grabbed each corner of the element and pulled them along a certain angle.

The coordinates of each point are modified by a value proportionate to the specified angle and the distance to the
origin. Thus, the farther from the origin a point is, the greater the value added to it.

## Syntax

The `skew()` function is specified with either one or two values, which represent the amount of skewing to
be applied in each direction. If you only specify one value it is used for the x-axis and there will be no skewing on
the y-axis.

```css
skew(ax)

skew(ax, ay)
```

### Values

- `ax`
  - : Is an {{cssxref("&lt;angle&gt;")}} representing the angle to use to distort the element along the x-axis (or
    abscissa).
- `ay`
  - : Is an {{cssxref("&lt;angle&gt;")}} representing the angle to use to distort the element along the y-axis (or
    ordinate). If not defined, its default value is `0`, resulting in a purely horizontal skewing.

<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Cartesian coordinates on ℝ^2</th>
      <th scope="col">Homogeneous coordinates on ℝℙ^2</th>
      <th scope="col">Cartesian coordinates on ℝ^3</th>
      <th scope="col">Homogeneous coordinates on ℝℙ^3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td rowspan="2">
        <math
          ><mfenced
            ><mtable
              ><mtr
                ><mtd><mn>1</mn> </mtd
                ><mtd
                  ><mo>tan</mo>
                  <mo>(</mo>
                  <mi>ax</mi>
                  <mo>)</mo>
                </mtd></mtr
              ><mtr
                ><mtd
                  ><mo>tan</mo>
                  <mo>(</mo>
                  <mi>ay</mi>
                  <mo>)</mo> </mtd
                ><mtd><mn>1</mn></mtd></mtr
              ></mtable
            ></mfenced
          ></math
        >
      </td>
      <td>
        <math
          ><mfenced
            ><mtable
              ><mtr
                ><mtd><mn>1</mn> </mtd
                ><mtd
                  ><mo>tan</mo>
                  <mo>(</mo>
                  <mi>ax</mi>
                  <mo>)</mo> </mtd
                ><mtd><mn>0</mn> </mtd></mtr
              ><mtr
                ><mtd
                  ><mo>tan</mo>
                  <mo>(</mo>
                  <mi>ay</mi>
                  <mo>)</mo> </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
              ><mtr></mtr></mtable></mfenced
        ></math>
      </td>
      <td rowspan="2">
        <math
          ><mfenced
            ><mtable
              ><mtr
                ><mtd><mn>1</mn> </mtd
                ><mtd
                  ><mo>tan</mo>
                  <mo>(</mo>
                  <mi>ax</mi>
                  <mo>)</mo> </mtd
                ><mtd><mn>0</mn> </mtd></mtr
              ><mtr
                ><mtd
                  ><mo>tan</mo>
                  <mo>(</mo>
                  <mi>ay</mi>
                  <mo>)</mo> </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
            ></mfenced
          ></math
        >
      </td>
      <td rowspan="2">
        <math
          ><mfenced
            ><mtable
              ><mtr
                ><mtd><mn>1</mn> </mtd
                ><mtd
                  ><mo>tan</mo>
                  <mo>(</mo>
                  <mi>ax</mi>
                  <mo>)</mo> </mtd
                ><mtd><mn>0</mn> </mtd><mtd><mn>0</mn> </mtd></mtr
              ><mtr
                ><mtd
                  ><mo>tan</mo>
                  <mo>(</mo>
                  <mi>ay</mi>
                  <mo>)</mo> </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
            ></mfenced
          ></math
        >
      </td>
    </tr>
    <tr>
      <td><code>[1 tan(ay) tan(ax) 1 0 0]</code></td>
    </tr>
  </tbody>
</table>

## Examples

### Skewing on the x-axis only

#### HTML

```html
<div>Normal</div>
<div class="skewed">Skewed</div>
```

#### CSS

```css
body {
  margin: 20px;
}

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

.skewed {
  transform: skew(10deg); /* Equal to skewX(10deg) */
  background-color: pink;
}
```

#### Result

{{EmbedLiveSample("Skewing_on_the_x-axis_only", 200, 200)}}

### Skewing on both axes

#### HTML

```html
<div>Normal</div>
<div class="skewed">Skewed</div>
```

#### CSS

```css
body {
  margin: 20px;
}

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

.skewed {
  transform: skew(10deg, 10deg);
  background-color: pink;
}
```

#### Result

{{EmbedLiveSample("Skewing_on_both_axes", 200, 200)}}

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{cssxref("transform")}}
- {{cssxref("&lt;transform-function&gt;")}}
- [skewX()](/en-US/docs/Web/CSS/transform-function/skewX)
- [skewY()](/en-US/docs/Web/CSS/transform-function/skewY)
