0
0
Tailwindmarkup~20 mins

Transform (scale, rotate, translate) in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Transform Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2:00remaining
What is the visual result of this Tailwind transform?

Given this HTML snippet with Tailwind classes, what will you see in the browser?

<div class="w-24 h-24 bg-blue-500 transform scale-150"></div>
Tailwind
<div class="w-24 h-24 bg-blue-500 transform scale-150"></div>
AA blue square 1.5 times bigger than the original 6rem by 6rem size
BA blue square 0.5 times smaller than the original size
CA blue square translated 150 pixels to the right
DA blue square rotated 150 degrees
Attempts:
2 left
💡 Hint

Look at the scale-150 class and remember it changes size.

📝 Syntax
intermediate
1:30remaining
Which Tailwind class correctly rotates an element 45 degrees clockwise?

Choose the Tailwind class that rotates an element 45 degrees clockwise.

Arotate-90
B-rotate-45
Crotate45
Drotate-45
Attempts:
2 left
💡 Hint

Tailwind uses rotate- followed by the degree number without spaces.

🧠 Conceptual
advanced
2:00remaining
What happens if you combine translate-x-4 and scale-50 on the same element?

Consider an element with these Tailwind classes: transform translate-x-4 scale-50. What is the combined effect?

AThe element moves 1rem to the right and shrinks to half its size
BThe element moves 4rem to the right and doubles in size
CThe element moves 4 pixels to the right and shrinks to half its size
DThe element moves 1rem to the left and doubles in size
Attempts:
2 left
💡 Hint

Remember Tailwind spacing units are multiples of 0.25rem. Also, scale-50 means 50% size.

selector
advanced
1:30remaining
Which Tailwind class applies a 90-degree counterclockwise rotation?

Choose the correct Tailwind class that rotates an element 90 degrees counterclockwise.

Arotate--90
Brotate-90
C-rotate-90
Drotate-270
Attempts:
2 left
💡 Hint

Negative rotation classes start with a minus sign before the class name.

accessibility
expert
2:30remaining
How to ensure keyboard users notice a translated and scaled focus ring in Tailwind?

You have a button with transform scale-110 translate-y-1 on focus. What is the best way to keep the focus ring accessible and visible for keyboard users?

AAdd <code>focus:outline-none</code> to remove the default focus ring
BUse <code>focus-visible:ring-4 focus-visible:ring-blue-500</code> with transform classes
CApply <code>pointer-events-none</code> to the button on focus
DUse <code>focus:opacity-0</code> to hide the button on focus
Attempts:
2 left
💡 Hint

Focus rings help keyboard users see where they are. Tailwind has special classes for focus-visible.