Course contentsShow
← Web Development
Lesson 628 of 2,98211. Utility-First CSS with TailwindFree lesson

Transforms: Scale, Rotate, and Translate

Transform elements with scale-*, rotate-*, and translate-* utilities for animations and layouts.

Transforms: Scale, Rotate, and Translate

You'll learn how to use Tailwind's transform utilities to scale, rotate, and translate elements for dynamic animations and layouts.

The Core Idea

In Tailwind CSS, transforms let you visually manipulate elements without affecting their surrounding layout flow. Think of it like moving a photo on your desk—you can spin it, make it bigger, or slide it around, but it still "owns" the same original space.

The Utilities

Tailwind provides three main transform families:

Scale (scale-*) — Changes an element's size

  • scale-50 makes it 50% of original size
  • scale-100 is normal size (100%)
  • scale-150 makes it 150% larger
  • You can also use scale-x-* or scale-y-* for directional scaling

Rotate (rotate-*) — Spins an element

  • rotate-45 rotates 45 degrees clockwise
  • rotate-90, rotate-180 for common angles
  • -rotate-45 rotates counter-clockwise

Translate (translate-*) — Moves an element from its original position

  • translate-x-4 shifts right by 1rem
  • -translate-y-2 shifts up by 0.5rem
  • Combines with your spacing scale

Combining Transforms

You can stack multiple transforms on a single element:

<div class="scale-110 rotate-12 translate-x-4">
  <!-- Scaled 110%, rotated 12°, shifted right -->
</div>

These utilities are especially powerful with hover states:

<button class="hover:scale-105 hover:-translate-y-1 transition">
  Lift on hover
</button>

Key Takeaway: Tailwind's scale-*, rotate-*, and translate-* utilities provide simple, composable ways to transform elements visually, perfect for creating interactive effects and smooth animations without writing custom CSS.