A. Links centered horizontally with equal space between, light gray background, blue links that darken on hover
B. Links stacked vertically with no spacing, white background, red links
C. Links aligned left with no spacing, dark background, blue links
D. Links centered vertically with large gaps, gray background, black links
Solution
Step 1: Analyze layout classes
flex justify-center space-x-6 centers links horizontally with 1.5rem space between each link.
Step 2: Analyze styling classes
bg-gray-100 p-4 adds a light gray background and padding. Link text is blue and darkens on hover due to text-blue-600 hover:text-blue-800.
Final Answer:
Links centered horizontally with equal space between, light gray background, blue links that darken on hover -> Option A
Quick Check:
flex center + space-x-6 + bg-gray-100 + blue hover = Links centered horizontally with equal space between, light gray background, blue links that darken on hover [OK]
Hint: Look for flex + justify-center + space-x for horizontal spaced nav [OK]
Common Mistakes:
Confusing space-x-6 with vertical spacing
Ignoring hover color changes
Misreading bg-gray-100 as dark background
4. Identify the error in this Tailwind navigation bar code:
A. Missing justify-center to center links horizontally
B. Using space-y-4 with flex-row causes vertical spacing instead of horizontal
C. px-3 py-2 should be replaced with margin classes
D. flex-row should be flex-col for horizontal layout
Solution
Step 1: Understand flex direction and spacing
flex-row arranges items horizontally, but space-y-4 adds vertical spacing between items instead of horizontal spacing.
Step 2: Identify correct spacing utility
For horizontal spacing between flex-row items, space-x-4 should be used instead of space-y-4.
Final Answer:
Using space-y-4 with flex-row causes vertical spacing instead of horizontal -> Option B
Quick Check:
flex-row + space-y = wrong spacing [OK]
Hint: Use space-x for horizontal flex, space-y for vertical flex [OK]
Common Mistakes:
Mixing space-x and space-y with wrong flex direction
Assuming space-y works horizontally
Ignoring flex-row meaning
5. You want a responsive navigation bar that shows links horizontally on large screens and stacks them vertically on small screens using Tailwind CSS. Which class combination achieves this?
hard
A. flex flex-col lg:flex-row space-y-4 lg:space-y-0 lg:space-x-6
B. grid grid-cols-3 sm:grid-cols-1 gap-4
C. flex flex-row sm:flex-col space-x-6 sm:space-x-0 sm:space-y-4
D. block lg:flex space-x-4 space-y-4
Solution
Step 1: Understand responsive flex direction
flex flex-col lg:flex-row means default is vertical stacking, switching to horizontal on large screens.
Step 2: Adjust spacing for each layout
space-y-4 adds vertical spacing by default, lg:space-y-0 lg:space-x-6 removes vertical spacing and adds horizontal spacing on large screens.
Final Answer:
flex flex-col lg:flex-row space-y-4 lg:space-y-0 lg:space-x-6 -> Option A
Quick Check:
Responsive flex-col to flex-row with spacing changes = flex flex-col lg:flex-row space-y-4 lg:space-y-0 lg:space-x-6 [OK]
Hint: Use mobile-first flex-col, then lg:flex-row with spacing overrides [OK]
Common Mistakes:
Reversing mobile and large screen flex directions
Not adjusting spacing for each screen size
Using grid instead of flex for this pattern
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.