我有一些使用TailwindCSS风格的按钮.
这些按钮包含一些图标/帮助文本(<span>
),当鼠标位于按钮上时,这些图标/帮助文本应该接收 colored颜色 (different than the color used for button text).
我在按钮上使用了group
类,然后在内部元素中:
<script src="https://cdn.tailwindcss.com#.js"></script>
<button class="group bg-indigo-500 hover:enabled:bg-indigo-400 disabled:cursor-not-allowed">
<span class="group-hover:text-pink-900">helper text</span>
</button>
<button disabled class="group bg-indigo-500 hover:enabled:bg-indigo-400 disabled:cursor-not-allowed">
<span class="group-hover:text-pink-900">helper text</span>
</button>
通知仅在the button is enabled时设置悬停效果(使用hover:enabled
).
如果按钮为disabled,我想在帮助器文本上禁用此悬浮效果.
我已经try 了group-hover:enabled:text-pink-900
个,但不起作用.
disabled:pointer-events-none
对我来说不是一个 Select ,因为它会打破disabled:cursor-not-allowed
.