Wait, What's [&_button] in Tailwind? Understanding &, >, and _ Selectors for Nested Elements
· 12 min read
I saw this weird Tailwind class: [&_button]:rounded-lg and had no idea what the & and _ meant! 🤔 It looked like CSS, but also different? My mentor explained these are arbitrary variant selectors—Tailwind's way of targeting child elements. The _ (underscore) represents a space in CSS selectors, and it's the key to styling deeply nested children. This conversation unlocked a whole new level of Tailwind power!
