HTML & CSS
/Advanced
Translate, Scale, Rotate
Definition
While historically these were functions passed into the `transform` property, modern CSS allows you to declare `translate`, `scale`, and `rotate` as independent CSS properties.
Explain Like I'm New
The old way was annoying: if you wanted to rotate a box that was ALREADY scaled, you had to write `transform: scale(1.5) rotate(45deg)`. If you forgot the `scale`, it would shrink back down. The new way lets you animate them completely independently: `scale: 1.5;` and `rotate: 45deg;`.
Real World Example
Writing much cleaner hover and keyframe animations without having to copy/paste massive `transform` strings.
Common Use Cases
- •Cleaner CSS code
- •Independent animation control
Interactive Example
Interview Questions
basic
- What does `scale: 0.5;` do to an element?
intermediate
- Why are independent transform properties better than the single `transform` property?