Complete the code to add a Tailwind class that makes the text blue.
function BlueText() {
return <p className="[1]">This text is blue.</p>;
}The text-blue-500 class colors the text blue in Tailwind CSS.
Complete the code to add padding of 4 units using Tailwind.
function PaddedBox() {
return <div className="[1] bg-gray-100">Content inside padded box</div>;
}The p-4 class adds padding on all sides with size 4 in Tailwind CSS.
Fix the error in the React component to apply Tailwind classes correctly.
function Button() {
return <button class=[1]>Click me</button>;
}class instead of className.In React JSX, className expects a string. The string must be inside quotes. Also, the attribute name should be className, not class.
Fill both blanks to create a responsive Tailwind button that is blue on small screens and green on medium screens.
function ResponsiveButton() {
return <button className="[1] [2] px-4 py-2 rounded">Click me</button>;
}The sm:bg-blue-500 class applies blue background on small screens, and md:bg-green-500 applies green background on medium screens and up.
Fill all three blanks to create a React component with a Tailwind card that has shadow, padding, and rounded corners.
function Card() {
return (
<div className="[1] [2] [3] bg-white">
<h2 className="text-xl font-bold mb-2">Card Title</h2>
<p>This is a card with shadow, padding, and rounded corners.</p>
</div>
);
}shadow-lg adds a large shadow, p-6 adds padding, and rounded-lg rounds the corners of the card.