0
0
Tailwindmarkup~20 mins

Margin utilities in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Margin Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding margin shorthand in Tailwind CSS
Which Tailwind CSS class adds a margin of 1rem to the top and bottom, and 0.5rem to the left and right of an element?
Am-4 m-x-2
Bmy-4 mx-2
Cmt-4 mb-4 ml-2 mr-2
Dm-4 mx-2
Attempts:
2 left
💡 Hint
Remember that 'my-' controls vertical margins and 'mx-' controls horizontal margins.
📝 Syntax
intermediate
2:00remaining
Identify the invalid Tailwind margin class
Which of the following Tailwind CSS margin classes is NOT valid and will cause the styles not to apply?
Amy-13
Bmx-7
Cml-3
Dmr-5
Attempts:
2 left
💡 Hint
Check the default spacing scale in Tailwind CSS for margin values.
rendering
advanced
2:00remaining
Visual effect of negative margin in Tailwind CSS
What visual effect will the class -mt-6 have on an element?
AAdds a margin-top of 1.5rem pushing the element down
BAdds a negative margin-bottom of 1.5rem pulling the element upward
CAdds a margin-bottom of 1.5rem pushing the element down
DAdds a negative margin-top of 1.5rem pulling the element upward
Attempts:
2 left
💡 Hint
Negative margin classes start with a dash and move the element opposite to the margin direction.
selector
advanced
2:00remaining
Combining margin utilities for responsive design
Which Tailwind CSS class combination applies a margin-left of 2rem on medium screens and larger, but no margin on smaller screens?
Aml-0 md:ml-8
Bml-8 md:ml-0
Cmd:ml-8 ml-0
Dml-8 md:ml-8
Attempts:
2 left
💡 Hint
Remember Tailwind applies mobile-first styles, so unprefixed classes apply to all sizes unless overridden.
accessibility
expert
3:00remaining
Accessibility impact of margin utilities on focus outlines
If you apply large negative margins (e.g., -m-10) to a focusable button, what accessibility issue might occur?
ANegative margins have no effect on accessibility
BThe button will become unfocusable by keyboard users
CThe button's focus outline might be clipped or hidden, making keyboard navigation difficult
DThe button's click area will increase, improving accessibility
Attempts:
2 left
💡 Hint
Think about how negative margins affect element positioning and visible outlines.