# skewX()

> The `skewX()` CSS function skews an element along the X-axis.

## How do I slant an element horizontally with skewX() in CSS?

The function that skews an element horizontally along the X-axis. It slants the element left or right, distorting its shape and creating an effect as though the element is being pushed sideways.

- 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
.tab {
  transform: skewX(-20deg);
}
```

Right:

```css
.tab {
  transform: skewX(-20deg);
}
.tab > span {
  display: inline-block;
  transform: skewX(20deg);
}
```

The inner span undoes the skew, so the tab is slanted but the text is not.

## Common mistakes

- The label of a slanted tab looks italic and blurry.

## Key points

- Text inside a `skewX()` parent is counter-skewed with the opposite angle.
- Angles near '90deg' are avoided, because the element stretches to infinity.

## Interview questions

### Why does my counter-skew not work on a span?

Transforms do not apply to plain inline elements. Set `display: inline-block` on the span first.

### Is skewX() the same as skew() with one value?

Yes. `skew(20deg)` and `skewX(20deg)` give the same result.

## Related cards

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

---

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