# skewY()

> The `skewY()` CSS function skews an element along the Y-axis.

## How do I make a diagonal section edge with skewY() in CSS?

The function that skews an element vertically along the Y-axis by the given angle. This transformation slants the element up or down, turning rectangles into parallelograms.

- 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
.section {
  transform: skewY(-4deg);
}
```

Right:

```css
.section { position: relative; isolation: isolate; }
.section::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--bg);
  transform: skewY(-4deg);
}
```

Only the background is skewed, so the section gets a diagonal edge while its text stays level.

## Common mistakes

- Skewing the whole section and getting tilted text.

## Key points

- Diagonal section edges skew a background layer, not the section with its content.
- Extra vertical padding covers the corners that `skewY()` leaves uncovered.

## Interview questions

### Should I use skewY() or clip-path for diagonal sections?

Both work. `clip-path: polygon()` cuts the edge without moving pixels, while `skewY()` tilts a whole layer.

### Why are there gaps at the corners after skewY()?

Skewing moves the corners up and down; add vertical padding or scale the layer slightly to cover them.

## Related cards

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

---

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