Questions
6 of 30
1What is the purpose of the transform property in CSS?
2What are the different types of CSS transformations?
3What does transform: translate() do?
4What is the difference between translateX() and translateY()?
5How does rotate() work in CSS?
6What is the unit used in rotation?
7What is the difference between scale() and scaleX(), scaleY()?
8What happens when you use negative values in scale()?
9What does the skew() function do?
10Can you combine multiple transform functions together? How? What is the use of the transform-origin property?
11What is the default transform-origin value?
12How does changing transform-origin affect rotation or scaling?
13What is the difference between translate() and using position or margin for movement?
14What is the difference between 2D and 3D transformations?
15What is the difference between 2D and 3D transformations?
16How do you apply a 3D rotation using CSS?
17How do you apply a 3D rotation using CSS?
18What are perspective and perspective-origin in 3D transforms? What is the purpose of transform-style: preserve-3d?
19What is the use of matrix() in CSS transforms?
20What’s the difference between matrix() and matrix3d()?
21How can you center an element using transform and translate()?
22What is the transition property in CSS used for?
23What are the four main components of a transition?
24What does transition-duration specify?
25What are the common timing function values (e.g., ease, linear, ease-in)?
26What is the shorthand syntax for transition?
27Can multiple CSS properties be transitioned simultaneously? How does transition differ from animation in CSS?
28Can you apply a transition to an element’s pseudo-class (like :hover)?
29Can transitions be triggered by JavaScript?
30What happens if transition-duration is set to 0s?
06 / 30

What is the unit used in rotation?

Units Used in CSS Rotation

In CSS, rotation angles in the rotate() function are defined using angle units. These units determine how much an element is rotated clockwise or counterclockwise around its origin point.

Supported Units for Rotation
  1. 1

    deg — degrees. A full circle equals 360deg (most commonly used).

  2. 2

    rad — radians. A full circle equals approximately 6.2832 radians (2π).

  3. 3

    grad — gradians. A full circle equals 400grads.

  4. 4

    turn — turns. A full circle equals 1turn.

Example: Using Different Rotation Units

While all these units are valid, deg (degrees) is most widely used for simplicity and readability.

Tip
  1. 1

    Use positive angles for clockwise rotation and negative angles for counterclockwise rotation.

  2. 2

    You can animate between different rotation units using transition or animation.

Difficulty: 2/10
Topics: CSS transforms, rotate(), units

Scenario Questions

0-2 years experience
  1. 1

    You need to rotate an icon 90 degrees clockwise using CSS. How would you write the rule, and which unit would you use?

  2. 2

    If you write transform: rotate(0.5); what will happen in the browser and why?

2-5 years experience
  1. 1

    A component that uses rotate(45) stopped rotating after a recent refactor. Walk me through how you'd debug the issue.

  2. 2

    When animating a spinner, you notice the rotation speed is inconsistent across browsers. How does the choice of unit (deg vs rad) affect this, and what would you choose?

5-8 years experience
  1. 1

    Our design system defines rotation values in turn units for consistency, but many existing components use deg. How would you approach refactoring the codebase to adopt a single unit without breaking production?

  2. 2

    Explain the performance implications, if any, of using rotate(0.5turn) versus rotate(180deg) in a high‑frequency animation on a page with thousands of elements.

8+ years experience
  1. 1

    We are building a cross‑platform UI library that needs to generate CSS for both web and native (React Native) targets. How would you design an abstraction for rotation that handles unit differences and ensures maintainability across teams?

  2. 2

    A legacy product uses custom JavaScript to compute rotation angles in radians and injects them into CSS. What strategy would you propose to migrate to a declarative CSS approach while minimizing risk and technical debt?

Follow-up Questions

  • What happens if you omit the unit in a rotate() call?
  • Which unit would you pick for a design system and why?
  • Are there any browser compatibility concerns with rad or turn units?