Last updated: 19 May 2024

Tailwind CSS Rotate

The rotate utility class in Tailwind CSS allows you to apply rotation transforms to elements on your web page.


Tailwind Rotate

The rotate utility class in Tailwind CSS allows you to apply rotation transforms to elements on your web page. With Tailwind's rotate class, you can easily rotate elements to achieve various design effects.

Applying Rotation

To apply rotation to an element, you can use the rotate-{angle} utility class, where {angle} represents the desired rotation angle. The available angle values are:

  • rotate-0: No rotation. The element remains in its original position.
  • rotate-45: Rotates the element 45 degrees clockwise.
  • rotate-90: Rotates the element 90 degrees clockwise.
  • rotate-180: Rotates the element 180 degrees clockwise.
  • rotate-270: Rotates the element 270 degrees clockwise.
  • rotate-{custom}: Allows you to define a custom rotation angle. Replace {custom} with the desired angle in degrees. Here's an example:
html
<div class="rotate-90">
<!-- Content here -->
</div>
<div class="rotate-12">
<!-- Content here -->
</div>
<div class="rotate-45">
<!-- Content here -->
</div>

Preview

Responsive Rotation

Tailwind CSS allows you to apply rotation classes responsively at different breakpoints. To use responsive rotation classes, you can append the breakpoint prefix to the utility class. For example, md:rotate-90 applies a rotation of 90 degrees starting from the medium breakpoint and above.

html
<div class="rotate-90 md:rotate-180">
<!-- Content here -->
</div>

In the above example, the rotation of the <div> element is set to 90 degrees by default, but starting from the medium breakpoint and above, it changes to 180 degrees.

Tailwind Rotate Class Table

ClassProperties
rotate-0 --tw-rotate: 0deg;
rotate-1 --tw-rotate: 1deg;
rotate-2 --tw-rotate: 2deg;
rotate-3 --tw-rotate: 3deg;
rotate-6 --tw-rotate: 6eg;
rotate-12 --tw-rotate: 12deg;
rotate-45--tw-rotate: 45deg;
rotate-90 --tw-rotate: 90deg;
rotate-180 --tw-rotate: 180deg;
-rotate-180 --tw-rotate: -180deg;
-rotate-90 --tw-rotate: -90eg;
-rotate-45 --tw-rotate: -45deg;
-rotate-12 --tw-rotate: -12deg;
-rotate-6--tw-rotate: -6deg;
-rotate-3 --tw-rotate: -3deg;
-rotate-2 --tw-rotate: -2deg;
-rotate-1 --tw-rotate: -1deg;

Windframe Tailwind blocks

landing page

Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs

Start building stunning tailwind UIs! 

Build from scratch or select prebuilt tailwind templates