Tailwind CSS Transform
Apply CSS transforms in Tailwind with transform utilities. Covers scale, rotate, translate, skew, transform-origin, and GPU-accelerated animations.
Interactive Transform Playground
Try each class live and inspect the CSS output.
transformtransform: translateX(0.25rem) rotate(2deg);The transform utility in Tailwind CSS lets you apply 2D and 3D transformation effects to elements with simple class names. You can rotate, scale, translate, or skew elements directly in your markup, making it easy to add motion, perspective, or depth to your designs, all without writing custom CSS.
How the Transform Utility Works
To enable transformations on an element, you start by adding the transform class. Then, combine it with specific transformation utilities that define how the element should move, scale, or rotate.
Each transformation type in Tailwind follows a clear pattern:
{type}-{value} — where {type} specifies the transformation and {value} controls its degree, offset, or scale factor.
1. rotate-{angle}
This classes Rotates an element by a set number of degrees.
Example:
1<div class="transform rotate-45 bg-blue-500 w-16 h-16"></div>
Use when: You want to turn or tilt elements slightly — great for icons, cards, or decorative shapes.
2. scale-{factor}
The scale classes Scales the size of an element up or down relative to its original size.
1<div class="transform scale-50 bg-blue-500 w-16 h-16"></div>2<div class="transform scale-100 bg-blue-500 w-16 h-16"></div>3<div class="transform scale-125 bg-blue-500 w-16 h-16"></div>
Use when: Creating hover effects, emphasizing elements, or animating interactions.
3. translate-x-{value} and translate-y-{value}
This classes is used to move an element along the horizontal (x) or vertical (y) axis.
1<div class="transform translate-x-4 translate-y-6 bg-blue-500 w-16 h-16"></div>2<div class="transform translate-x-5 translate-y-3 bg-blue-500 w-16 h-16"></div>3<div class="transform translate-x-6 translate-y-1 bg-blue-500 w-16 h-16"></div>
Use when: Adjusting layout positions or creating subtle motion effects.
4. skew-x-{angle} and skew-y-{angle}
You can use this transform class to tilt an element along the x-axis or y-axis to create a slanted appearance.
1<div class="transform skew-y-12 bg-blue-500 w-16 h-16"></div>2<div class="transform skew-y-12 skew-x-14 bg-blue-500 w-16 h-16"></div>3<div class="transform skew-y-20 bg-blue-500 w-16 h-16"></div>
Use when: Adding dynamic or playful angles to shapes, banners, or hero elements.
Responsive Transforms
Tailwind makes it easy to apply different transformations at various breakpoints using responsive prefixes. Simply add the prefix (like sm:, md:, lg:, or xl:) before the transformation class.
1<div class="rounded-t-xl overflow-hidden bg-purple-100 p-6 md:p-8">2 <div class="flex flex-col items-center justify-center gap-6 sm:flex-row sm:justify-around md:gap-12">3 <div class="w-16 h-16 bg-purple-400 transform rotate-45 md:rotate-90"></div>4 <div class="w-16 h-16 bg-purple-400 sm:w-20 sm:h-20 flex items-center justify-center">5 <div class="w-16 h-16 bg-yellow-400 transform skew-y-14"></div>6 </div>7 <div class="w-16 h-16 bg-purple-400 sm:w-20 sm:h-20 relative">8 <div class="absolute inset-0 bg-yellow-400 transform translate-x-3 translate-y-2 sm:translate-x-4 sm:translate-y-3"></div>9 </div>10 </div>11</div>
This element is rotated by 45° by default, but on medium screens and larger, it rotates to 90° instead.
Responsive transforms help you fine-tune how elements behave across screen sizes, maintaining both design and usability.
Real-World Applications of Transform
Here’s how transformations are commonly used in actual projects:
1. Hover Animations
1<button2 class="transform hover:scale-110 transition duration-200 bg-indigo-600 text-white px-4 py-2 rounded"3>4 Hover Me5</button>
Preveiw
The element scales up slightly when hovered — a simple, elegant way to add interactivity.
2. Dynamic Cards or Tiles
1<div2 class="transform hover:-rotate-3 bg-white shadow-md p-4 rounded transition duration-300"3>4 <h3 class="font-semibold">Interactive Card</h3>5 <p class="text-gray-600 text-sm">6 A slight rotation adds personality to your UI.7 </p>8</div>
Interactive Card
A slight rotation adds personality to your UI.
Adds a subtle rotation on hover, often used in modern card layouts for motion and depth.
3. Floating Elements or Badges
1<div2 class="transform translate-y-2 bg-blue-500 text-white px-3 py-1 rounded-full inline-block"3>4 New5</div>
New
Shifts the element slightly downward — helpful for badges, labels, or floating effects.
4. Skewed Hero Section
1<section class="relative bg-blue-600 text-white py-16">2 <div class="absolute inset-0 transform -skew-y-3 bg-blue-700"></div>3 <div class="relative text-center">4 <h1 class="text-3xl font-bold">Creative Layouts with Skew</h1>5 <p class="text-blue-200 mt-2">6 Add unique angles to section backgrounds using skew transforms.7 </p>8 </div>9</section>
Creative Layouts with Skew
Add unique angles to section backgrounds using skew transforms.
Skewing backgrounds adds visual interest without extra graphics or complex positioning.
5. Animated Transitions
1<div2 class="transform hover:translate-x-4 hover:rotate-6 transition duration-300 bg-blue-500 w-16 h-16 rounded"3></div>
Combines translation and rotation for dynamic, engaging movement in hover animations.
Tailwind Transform Class Table
| Class | Properties |
|---|---|
| transform | --tw-translate-x:0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; transform: translateX(var(--tw-translate-x)) translateY(var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); |
| transform-gpu | --tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1; transform: translate3d(var(--tw-translate-x), var(--tw-translate-y), 0) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); |
| transform-none | transform: none |
✨ What's Next?
Now that you’ve mastered Tailwind Transform, try experimenting with:
Windframe Tailwind blocks
Windframe is an AI visual editor for rapidly building stunning web UIs & websites
Start building stunning web UIs & websites!

