CSS transform: skewY()

The CSS skewY() function is used to define the transform property, to skew an element vertically (on y-axis).

Skewing an element on y-axis means, the element will neither be parallel nor intersect the y-axis, as shown in the following snapshot:

css skewY example

For example:

HTML with CSS Code
<!DOCTYPE html>
<html>
<head>
   <style>
      div{width: 120px; height: 60px; background: peru; margin: auto;}
      .b{transform: skewY(20deg);}
      .c{transform: skewY(45deg);}
      .d{transform: skewY(60deg);}
      .e{transform: skewY(90deg);}
      .f{transform: skewY(135deg);}
      .g{transform: skewY(180deg);}
      .h{transform: skewY(0deg);}
      .i{transform: skewY(-45deg);}
   </style>
</head>
<body>
   
   <h2>Without skewY()</h2>
   <div class="a"></div>

   <h2>skewY(20deg)</h2>
   <div class="b"></div>

   <h2>skewY(45deg)</h2>
   <div class="c"></div>

   <h2>skewY(60deg)</h2>
   <div class="d"></div>

   <h2>skewY(90deg)</h2>
   <div class="e"></div>

   <h2>skewY(135deg)</h2>
   <div class="f"></div>

   <h2>skewY(180deg)</h2>
   <div class="g"></div>

   <h2>skewY(0deg)</h2>
   <div class="h"></div>

   <h2>skewY(-45deg)</h2>
   <div class="i"></div>
   
</body>
</html>
Output

Without skewY()

skewY(20deg)

skewY(45deg)

skewY(60deg)

skewY(90deg)

skewY(135deg)

skewY(180deg)

skewY(0deg)

skewY(-45deg)

CSS skewY() Syntax

The syntax of skewY() function in CSS, is:

transform: skewY(val);

The value of val parameter will be any of the following:

  • deg - Stands for degree. One full circle is equal to 360deg
  • grad - Stands for gradians. One full circle is equal to 400grad
  • rad - Stands for Radians. One full circle is equal to 6.2832rad
  • turn - Stands for turns. One full circle is equal to 1turn

CSS Online Test


« Previous Tutorial Next Tutorial »