CSS transform: rotateY()

The CSS rotateY() function is used to define the transform property, to rotate an element along y-axis, in this way:

css rotatey example

For example:

HTML with CSS Code
<!DOCTYPE html>
      div{width: 120px; height: 60px; background: peru; margin: auto;}
      .b{transform: rotateY(12deg);}
      .c{transform: rotateY(25deg);}
      .d{transform: rotateY(45deg);}
      .e{transform: rotateY(80deg);}
      .f{transform: rotateY(90deg);}
      .g{transform: rotateY(135deg);}
      .h{transform: rotateY(180deg);}
   <h2>Without rotateY()</h2>
   <div class="a"></div>

   <div class="b"></div>

   <div class="c"></div>

   <div class="d"></div>

   <div class="e"></div>

   <div class="f"></div>

   <div class="g"></div>

   <div class="h"></div>

Without rotateY()








CSS rotateY() Syntax

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

transform: rotateY(degree);

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

  • deg - Stands for degree. One full circle is equal to 360deg. For example: 20deg, 132deg etc.
  • grad - Stands for gradians. One full circle is equal to 400grad. For example: 12grad, 324grad etc.
  • rad - Stands for Radians. One full circle is equal to 6.2832rad. For example: 0.32rad, 3.43rad etc.
  • turn - Stands for turns. One full circle is equal to 1turn. For example: 0.1turn, 0.46turn

CSS Online Test

« Previous Tutorial Next Tutorial »

Like/Share Us on Facebook 😋