CSS | rotate() Function
The rotate() function is an inbuilt function which is used to rotate an element based on the given angle as an argument. The angle can be set in terms of degrees, gradians, radians, or turns.
Syntax:
rotate( angle )
Parameters: This function accepts single parameter angle which represents the angle of rotations. The positive and negative angles rotate the elements in clockwise and counter-clockwise respectively.
Below examples illustrates the rotate() function in CSS:
Example 1:
<!DOCTYPE html> <html> <head> <title>CSS rotate() function</title> <style> body { text-align:center; } h1 { color:green; } .rotate_image { transform: rotate(45deg); } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>CSS rotate() function</h2> <br><br> <img class="rotate_image" src= alt="GeeksforGeeks logo"> </body> </html> |
Output:

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

Supported Browsers: The browsers supported by rotate() function are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Safari
- Opera
Recommended Posts:
- CSS | hue-rotate() Function
- p5.js | rotate() function
- PHP | Ds\Vector rotate() Function
- PHP | ImagickDraw rotate() Function
- PHP | Ds\Sequence rotate() Function
- PHP | Ds\Deque rotate() Function
- Node Jimp | rotate
- HTML canvas rotate() Method
- How to rotate an HTML div element 90 degrees using JavaScript ?
- How to call a function that return another function in JavaScript ?
- How to get the function name inside a function in PHP ?
- How to get the function name from within that function using JavaScript ?
- PHP | Ds\Map xor() Function
- PHP | min( ) Function
- PHP | max( ) Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




