skewY()

Term side of the Card.
Topic: Transformations
Unit title: skewY()
Categories: Function
Explanation side of the Card

Explanation: 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.

Browser compatibility:
  • The chrome browser supports this feature starting from version 1.
  • The edge browser supports this feature starting from version 12.
  • The firefox browser supports this feature starting from version 3.5.
  • The safari browser supports this feature starting from version 3.1.
Availability: 

Example

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

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy