Challenge - 5 Problems
Padding Pro
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ selector
intermediate1:30remaining
Which Tailwind class adds padding of 1rem on all sides?
Select the Tailwind CSS class that applies exactly 1rem padding on all four sides of an element.
Attempts:
2 left
💡 Hint
Tailwind padding classes use a scale where p-4 equals 1rem by default.
✗ Incorrect
In Tailwind CSS, p-4 applies 1rem padding on all sides. The scale is based on 0.25rem increments, so p-1 is 0.25rem, p-2 is 0.5rem, and p-6 is 1.5rem.
🧠 Conceptual
intermediate1:30remaining
What does the class
px-3 do in Tailwind CSS?Choose the correct description of the effect of the Tailwind class
px-3.Attempts:
2 left
💡 Hint
The 'x' in
px-3 stands for horizontal axis.✗ Incorrect
The class px-3 applies padding-left and padding-right of 0.75rem (3 * 0.25rem). It does not affect top or bottom padding or margins.
❓ rendering
advanced2:00remaining
What is the visual effect of applying
pt-8 pb-4 to a box?Given a box with these Tailwind classes:
pt-8 pb-4, what padding does it have?Tailwind
<div class="pt-8 pb-4 bg-blue-200">Content</div>Attempts:
2 left
💡 Hint
Remember Tailwind spacing scale: 8 means 2rem, 4 means 1rem.
✗ Incorrect
pt-8 sets padding-top to 2rem (8 * 0.25rem). pb-4 sets padding-bottom to 1rem (4 * 0.25rem). So top padding is larger than bottom padding.
❓ accessibility
advanced1:30remaining
Why is consistent padding important for accessibility?
Choose the best reason why consistent padding helps accessibility in web design.
Attempts:
2 left
💡 Hint
Think about how padding affects clickable or tappable areas.
✗ Incorrect
Consistent padding increases the size of interactive elements, making them easier to click or tap, which helps users who rely on keyboard or touch navigation.
📝 Syntax
expert1:30remaining
What error occurs if you write
p-x-4 in Tailwind CSS?Identify the problem with the class
p-x-4 and what happens when you use it.Tailwind
<div class="p-x-4">Example</div>Attempts:
2 left
💡 Hint
Tailwind uses specific order for padding classes like p, px, py.
✗ Incorrect
The class p-x-4 is invalid because Tailwind expects px-4 for horizontal padding. Invalid classes are ignored, so no padding is applied.