A. Because ml--8 is invalid syntax; negative margin must be -ml-8.
B. Because margin-left cannot be negative in Tailwind.
C. Because the width classes conflict with margin classes.
D. Because the boxes need padding, not margin.
Solution
Step 1: Check negative margin syntax
Negative margin classes start with a dash before the side abbreviation, e.g., -ml-8, not ml--8.
Step 2: Identify error cause
ml--8 is invalid and will not apply any margin, so no overlap occurs.
Final Answer:
Because ml--8 is invalid syntax; negative margin must be -ml-8. -> Option A
Quick Check:
Negative margin syntax = dash before side [OK]
Hint: Negative margin always starts with dash before side abbreviation [OK]
Common Mistakes:
Placing dash after side abbreviation
Assuming negative margin is not allowed
Mixing margin and padding classes
5. You want to create a card with an image that overlaps the card's top border by 1rem using Tailwind. Which class combination on the image achieves this effect?
hard
A. Use mb-4 on the image inside the card container.
B. Use mt-4 on the image inside the card container.
C. Use -mb-4 on the card container.
D. Use -mt-4 on the image inside the card container.
Solution
Step 1: Understand overlap direction
To pull the image upward outside the card's top border, apply a negative top margin on the image.
Step 2: Choose correct Tailwind class
-mt-4 applies a negative top margin of 1rem, pulling the image up to overlap.
Final Answer:
Use -mt-4 on the image inside the card container. -> Option D
Quick Check:
Negative top margin pulls element upward [OK]
Hint: Negative top margin (-mt-) pulls element upward to overlap [OK]