Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

CSS | rotate3d() Function

  • Last Updated : 08 Aug, 2019

The rotate3d() function is an inbuilt function which is used to rotate an element around a fixed axis in 3D space.

Syntax:

rotate3d( x, y, z, angle )

Parameters: This function accepts four parameters as mentioned above and described below:

  • x: It holds a number denoting the x-coordinate. Its value lies between 0 to 1.
  • y: It holds a number denoting the y-coordinate. Its value lies between 0 to 1.
  • z: It holds a number denoting the z-coordinate. Its value lies between 0 to 1.
  • angle: It holds the angle of rotation. The positive angle represents a clockwise rotation and a negative angle represents a counter-clockwise rotation.

Below examples illustrate the rotate3d() function in CSS:

Example 1:






<!DOCTYPE html> 
<html
<head
    <title>CSS rotate3d() function</title
    <style
        body {
            text-align:center;
        }
        h1 {
            color:green;
        }
        .rotate3d_image {
            transform: rotate3d(1, 1, 0, 60deg);
        }
    </style
</head
  
<body
    <h1>GeeksforGeeks</h1>
    <h2>CSS rotate3d() function</h2>
    <br><br>
      
    <img class="rotate3d_image" src
        alt="GeeksforGeeks logo"
</body
</html>            

Output:

Example 2:




<!DOCTYPE html> 
<html
<head
    <title>CSS rotate3d() function</title
    <style
        body {
            text-align:center;
        }
        h1 {
            color:green;
        }
        .GFG {
            font-size:35px;
            font-weight:bold;
            color:green;
            transform: rotate3d(1, 1, 0, 60deg);
        }
    </style
</head
  
<body
    <h1>GeeksforGeeks</h1>
    <h2>CSS rotate3d() function</h2>
    <br><br>
      
    <div class="GFG">Welcome to GeeksforGeeks</div
</body
</html>                     

Output:

Supported Browsers: The browsers supported by rotate3d() function are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera



My Personal Notes arrow_drop_up
Recommended Articles
Page :