A. A red border around the text with padding inside.
B. No border, only red text color.
C. A thick red background behind the text.
D. Text with no padding or border.
Solution
Step 1: Analyze the classes
border adds a 1px solid border, border-red-500 colors the border red, p-4 adds padding inside the div.
Step 2: Understand the visual output
The text "Hello" will have space around it (padding) and a red border around the entire box.
Final Answer:
A red border around the text with padding inside. -> Option A
Quick Check:
border + red color + padding = A [OK]
Hint: border + color class = colored border; p-4 adds padding [OK]
Common Mistakes:
Thinking border-red-500 colors text
Confusing padding with margin
Assuming background color changes
4. Identify the error in this Tailwind code that prevents the border from showing:
<div class="border-red-500 p-2">Content</div>
medium
A. Missing the base border class to define border width.
B. Incorrect padding class used.
C. border-red-500 is not a valid Tailwind class.
D. The div tag is not closed properly.
Solution
Step 1: Check border classes
border-red-500 sets border color but does not add border width or style alone.
Step 2: Identify missing class
The base border class is needed to add a 1px solid border; without it, color alone won't show a border.
Final Answer:
Missing the base border class to define border width. -> Option A
Quick Check:
border color needs base border class = A [OK]
Hint: Always include 'border' with color classes to show border [OK]
Common Mistakes:
Assuming color class adds border width
Confusing padding with border
Ignoring missing base border class
5. You want to create two side-by-side boxes with a clear boundary between them using Tailwind. Which combination of classes best achieves this?
hard
A. flex border border-gray-400 p-4 gap-4 on a container with two child divs without borders
B. grid grid-cols-2 border border-gray-400 p-4 on each child div separately
C. block border border-gray-400 p-4 on container only
D. flex gap-4 on container and border border-gray-400 p-4 on each child div
Solution
Step 1: Understand layout and boundaries
To place boxes side-by-side, use flex or grid on the container. To show boundaries between boxes, each box needs its own border.
Step 2: Evaluate options
flex gap-4 on container and border border-gray-400 p-4 on each child div uses flex gap-4 on container for spacing and adds border border-gray-400 p-4 on each child for clear boundaries. This creates distinct boxes with space between them.
Final Answer:
flex gap-4 on container and border on each child div -> Option D
Quick Check:
Separate borders on children + flex layout = C [OK]
Hint: Add borders on children, use flex with gap on container [OK]
Common Mistakes:
Adding border only on container hides boundaries between children