0Pricing
CSS Academy · Lesson

Translate Rotate and Scale

Move elements with translate(), rotate them with rotate(), and resize with scale().

Translate Rotate and Scale is a free CSS Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the CSS Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

The transform Property

transform applies 2D and 3D visual transformations to elements: movement, rotation, scaling, and skewing. Transforms happen after layout — they do not affect surrounding elements.

translate()

Moves an element from its current position. Arguments: x and y displacement.

.card:hover {
  transform: translate(0, -8px);
  /* lift 8px upward */
}

.centered {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

translateX() translateY() translateZ()

Individual axis functions for clarity:

.slide-in {
  transform: translateX(-100%);
}

.slide-in.active {
  transform: translateX(0);
}

rotate()

Rotates an element by a given angle. Positive values rotate clockwise.

.icon:hover {
  transform: rotate(180deg);
}

.spinner {
  transform: rotate(45deg);
}

scale()

Scales an element uniformly or by axis. Values less than 1 shrink; greater than 1 enlarge.

.btn:hover {
  transform: scale(1.05);
}

.thumb:hover {
  transform: scale(1.1);
}

scaleX() and scaleY()

Scale independently on one axis:

.logo {
  transform: scaleX(-1); /* horizontal mirror */
}

Combining Transforms

Multiple transform functions are applied in order (right to left). Order matters for the result.

.card:hover {
  transform: translateY(-8px) scale(1.02);
}

/* Rotate then translate vs translate then rotate produce DIFFERENT results */

Transform Origin

transform-origin sets the pivot point for rotations and scales. Default is center (50% 50%).

.card {
  transform-origin: top left;
}

.card:hover {
  transform: scale(1.05) rotate(2deg);
  /* scales and rotates from top-left corner */
}

Individual Transform Properties

Modern CSS allows setting individual transform functions as separate properties:

.card:hover {
  translate: 0 -8px;
  scale: 1.02;
  rotate: 2deg;
}

Transition with Transforms

Transform is one of the two GPU-composited properties. Always animate it with transition for smooth, performant effects:

.card {
  transition: transform 200ms ease;
}

.card:hover {
  transform: translateY(-4px);
}

translate() vs top/left

Always prefer transform: translate() over top/left for animation. Transform is GPU-composited; top/left triggers layout recalculation every frame.

Quick Check

Which transform function mirrors an element horizontally (like flipping a card)?

Recap

transform moves, rotates, and scales elements after layout without affecting surrounding content. Use translate() for movement, rotate() for rotation, scale() for resizing. Chain multiple functions in one declaration. Modern CSS supports individual transform properties. Always animate with transitions for GPU-composited performance.

Frequently asked questions

Is the “Translate Rotate and Scale” lesson free?

Yes — the full text of “Translate Rotate and Scale” is free to read here on the web, and the CSS Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the CSS Academy course, upgrade to CoddyKit PRO.

What will I learn in “Translate Rotate and Scale”?

Move elements with translate(), rotate them with rotate(), and resize with scale(). You practise CSS Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start CSS Academy?

No prior experience is required. CSS Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Translate Rotate and Scale” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this CSS Academy lesson?

Yes. Every CSS Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Translate Rotate and Scale
  2. Skew and Matrix Transforms
  3. Transform Origin and Perspective
  4. 3D Transforms: rotateX rotateY translateZ
← Back to CSS Academy