Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

How to rotate an element using CSS ?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The purpose of this article is to rotate an HTML element by using CSS transform property. This property is used to move, rotate, scale and to perform various kinds of transformation of elements.

The rotate() function can be used to rotate any HTML element or used for transformations. It takes one parameter which defines the rotation angle. The rotation angle consists of two parts, the value of the rotation followed by the unit of rotation. The unit can be defined in degrees (deg), gradient (grad), radians (rad) and turns.


transform: rotate(90deg);

Example: The following example demonstrates rotation of an image by 45 degree.


 <!DOCTYPE html> 
        body { 
        h1 { 
        .rotate_image { 
            transform: rotate(45deg); 
        How to rotate an element using CSS?
     <img class="rotate_image" src
          alt="GeeksforGeeks logo"

Before Rotation:

After Rotation:

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera
My Personal Notes arrow_drop_up
Last Updated : 31 Aug, 2020
Like Article
Save Article
Similar Reads
Related Tutorials