B. A centered white card with rounded corners, shadow, padding, and text styled with bold heading and gray paragraph
C. A full-width blue box with no padding and default text styles
D. An unstyled div with plain text
Solution
Step 1: Analyze container styles
The div uses max-w-sm (small max width), mx-auto (center horizontally), bg-white (white background), rounded (rounded corners), shadow-lg (large shadow), and p-4 (padding).
Step 2: Analyze text styles
The heading has text-xl (large text), font-bold (bold), and mb-2 (margin bottom). The paragraph uses text-gray-700 (medium gray text).
Final Answer:
A centered white card with rounded corners, shadow, padding, and text styled with bold heading and gray paragraph -> Option B
Quick Check:
Tailwind classes produce styled card = A [OK]
Hint: Read each Tailwind class meaning to visualize output [OK]
Common Mistakes:
Ignoring mx-auto for centering
Confusing bg-white with colored backgrounds
Missing padding or shadow effects
4. Identify the error in this React component using Tailwind:
function Button() {
return <button class="bg-green-500 text-white p-3">Submit</button>;
}
medium
A. Using class instead of className in JSX
B. Missing closing tag for button
C. Tailwind classes are invalid
D. Button text should be inside curly braces
Solution
Step 1: Check JSX attribute for CSS classes
In React JSX, the attribute must be className, not class.
Step 2: Verify other syntax
The button tag is properly closed and Tailwind classes are valid. Text inside button can be plain string.
Final Answer:
Using class instead of className in JSX -> Option A
Quick Check:
JSX requires className, not class [OK]
Hint: Always use className in React JSX for CSS classes [OK]
Common Mistakes:
Using class instead of className
Thinking Tailwind classes are invalid
Adding unnecessary curly braces around text
5. You want a React component with a responsive button that is blue on small screens and green on medium and larger screens using Tailwind. Which is the correct className value?
<button className="?">Click</button>
hard
A. "bg-blue-500 md:bg-green-500 text-white p-2 rounded"
B. "bg-green-500 md:bg-blue-500 text-white p-2 rounded"
C. "bg-blue-500 bg-green-500 md:text-white p-2 rounded"
D. "text-white p-2 rounded bg-blue-500 bg-green-500"
Solution
Step 1: Understand Tailwind responsive prefixes
Tailwind uses prefixes like md: to apply styles at medium screen sizes and above.
Step 2: Apply blue background by default and green on medium+
Use bg-blue-500 for small screens and md:bg-green-500 to override on medium and larger.
Step 3: Check other classes
Text color, padding, and rounding are consistent and correctly placed.
Final Answer:
"bg-blue-500 md:bg-green-500 text-white p-2 rounded" -> Option A
Quick Check:
Responsive prefix md: changes color on medium screens [OK]
Hint: Use md: prefix to change styles on medium screens up [OK]
Common Mistakes:
Reversing colors for small and medium screens
Placing classes in wrong order causing override issues
Using multiple background colors without responsive prefixes
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.