Advanced selectors and media variants
Tailwind variants can target relationships and environment conditions, such as child states, ARIA attributes, print styles, contrast preferences, or pointer capabilities where supported. These variants are powerful, but complex selector logic can become difficult to reason about when packed into one class string.
Use an advanced variant when the relationship is local and clear. If the selector becomes a hidden contract across many elements, extract a component or write a named CSS rule with a comment. Test uncommon states such as forced colors, keyboard navigation, and printing when your product supports them.
A class string should still be reviewable. When a selector becomes difficult to explain, use a named component or a small CSS rule instead of adding more variants.