Interview Q&A · questions with model answers

Tailwind CSS Interview Questions

Part of the study plan for: Frontend Engineer

Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.

  1. Most asked Why doesn't className={`bg-${color}-500`} work, and what should you do instead?

    Tailwind never sees the complete string bg-red-500 in your source, so it doesn't generate the rule. Map values to complete class strings (const styles = { red: "bg-red-500", green: "bg-green-500"…

  2. Why might a dropdown with z-50 appear behind another element?

    z-index only orders elements within the same stacking context. A parent with transform, filter, backdrop-blur, opacity below 1 or isolation creates a new context, so its child's z-50 can't rise…

Was this page helpful?

Report a mistake