0
0
Astroframework~20 mins

Tailwind CSS integration in Astro - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Tailwind CSS Mastery in Astro
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
How does Tailwind CSS apply styles in Astro components?
Given an Astro component using Tailwind CSS classes, what will be the visual output of the button below?
Astro
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">Click me</button>
AA red button with white text that becomes lighter red on hover and has square corners
BA button with no background color and black text that changes to gray on hover
CA blue button with white bold text that darkens blue on hover and has rounded corners
DA green button with white text that becomes darker green on hover and has sharp edges
Attempts:
2 left
💡 Hint
Look at the Tailwind classes: bg-blue-500 sets background, hover:bg-blue-700 changes it on hover, text-white sets text color, font-bold makes text bold, py-2 and px-4 add padding, rounded adds border radius.
📝 Syntax
intermediate
2:00remaining
Which Tailwind CSS config snippet correctly enables JIT mode in Astro?
Choose the correct Tailwind CSS configuration code to enable Just-In-Time (JIT) mode in an Astro project.
Aexport const config = { mode: 'just-in-time', content: ['./src/**/*'] }
Bexport default { jit: true, files: ['./src/**/*.{astro,js}'] }
Cmodule.exports = { jitMode: true, paths: ['./src/**/*'] }
Dmodule.exports = { mode: 'jit', content: ['./src/**/*.{astro,js,jsx,ts,tsx}'] }
Attempts:
2 left
💡 Hint
JIT mode is enabled by setting mode: 'jit' and specifying content paths in tailwind.config.js.
🔧 Debug
advanced
2:00remaining
Why does Tailwind CSS not apply styles in this Astro component?
This Astro component uses Tailwind classes but the styles do not appear in the browser. What is the most likely cause?
Astro
<div class="text-center p-4">
  <h1 class="text-3xl font-bold">Welcome</h1>
</div>
AThe class names are misspelled and do not match Tailwind's classes
BTailwind CSS is not imported or configured properly in the Astro project
CAstro does not support Tailwind CSS classes inside <div> elements
DThe browser does not support CSS classes with hyphens
Attempts:
2 left
💡 Hint
Check if Tailwind CSS is installed and linked correctly in the project setup.
state_output
advanced
2:00remaining
What is the rendered output of this Astro component using Tailwind and conditional classes?
Consider this Astro component code snippet. What will be the class attribute of the
Astro
---
const isActive = false;
---
<button class={`py-2 px-4 rounded ${isActive ? 'bg-green-500' : 'bg-gray-500'}`}>Submit</button>
Apy-2 px-4 rounded bg-gray-500
Bpy-2 px-4 rounded bg-green-500
Cbg-green-500 py-2 px-4 rounded
Dpy-2 px-4 rounded
Attempts:
2 left
💡 Hint
The template literal adds bg-green-500 if isActive is true, else bg-gray-500.
🧠 Conceptual
expert
2:00remaining
How does Tailwind CSS optimize CSS size in Astro projects?
Which mechanism does Tailwind CSS use to keep the final CSS bundle small when integrated with Astro?
AIt uses a purge process scanning Astro files to remove unused CSS classes
BIt compiles all possible CSS classes into one large file regardless of usage
CIt disables all responsive utilities to reduce CSS size
DIt requires manual deletion of unused CSS classes in the source files
Attempts:
2 left
💡 Hint
Think about how Tailwind removes unused styles automatically during build.