# skew()

> The `skew()` CSS function skews an element along the X and Y axes.

## How do I make a slanted button or shape with skew() in CSS?

The function that skews an element along both the X and Y axes. This transformation distorts the shape of an element by slanting it, which can be used to create a sense of movement or perspective in the design.

- Topic: Transformations
- Type: function
- Browser support: Chrome 1+, Chrome Android 18+, Edge 12+, Firefox 3.5+, Firefox Android 4+, Safari 3.1+, Safari iOS 3.2+

## Example

Wrong:

```css
.tag {
  transform: skew(-15deg);
}
```

Right:

```css
.tag { position: relative; isolation: isolate; }
.tag::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--accent);
  transform: skew(-15deg);
}
```

Skewing only the background pseudo-element gives a slanted shape while the label text stays straight.

## Common mistakes

- Skewing the button itself and getting slanted, hard-to-read text.
- Passing one value and expecting both axes to skew.

## Key points

- Slanted backgrounds skew a pseudo-element or wrapper, so the text stays upright.
- If the parent is skewed, the child text is counter-skewed by the same angle.
- Angles have units, such as `skew(-15deg)`.

## Interview questions

### What does skew() with one value do?

It skews along the X-axis only, like `skewX()`. The second value, if given, skews along the Y-axis.

### Is skew() the same as skewX() plus skewY()?

Not exactly. `skew(a, b)` is a single matrix, which differs from applying `skewX(a)` and then `skewY(b)`.

## Related cards

- [skewX()](https://wonderium.dev/css/skew-x.md)
- [skewY()](https://wonderium.dev/css/skew-y.md)
- [transform](https://wonderium.dev/css/transform.md)
- [::before](https://wonderium.dev/css/before.md)
- [clip-path](https://wonderium.dev/css/clip-path.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/skew
- Last updated: 2026-11-25
