Tailwind CSS 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: 6deg;
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: -90deg;
-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

Build modern projects using Bootstrap 5 and Contrast

Trying to create components and pages for a web app or website from scratch while maintaining a modern User interface can be very tedious. This is why we created Contrast, to help drastically reduce the amount of time we spend doing that. so we can focus on building some other aspects of the project.

Contrast Bootstrap PRO consists of a Premium UI Kit Library featuring over 10000+ component variants. Which even comes bundled together with its own admin template comprising of 5 admin dashboards and 23+ additional admin and multipurpose pages for building almost any type of website or web app.
See a demo and learn more about Contrast Bootstrap Pro by clicking here.

ad-banner