我目前的一個專案遇到了一個奇怪的問題
當我將滑鼠懸停在按鈕上并更改按鈕內的文本顏色時,我試圖讓按鈕更改其顏色
這非常有效,直到我將滑鼠懸停在觸發整個按鈕的懸停事件而不是其中的文本的邊框按鈕上
<a class="min-w-full lg:min-w-[0px]" target="_blank" href="https://stackoverflow.com">
<button
type="button"
class="border-4 border-github rounded-[12px] min-w-full lg:min-w-[0px] mx-1 mb-4 lg:mb-2 py-2 hover:bg-github transition duration-200 ease-in-out">
<span
class="w-full h-full select-none text-github text-2xl lg:text-3xl lg:px-
[6.625rem] font-semibold hover:text-background transition duration-100">
check this out
</span>
</button>
</a>
如何使按鈕的邊框不觸發懸停事件?
或者還有其他更好的方法來做我想做的事情嗎?
uj5u.com熱心網友回復:
group-hover
https://tailwindcss.com/docs/hover-focus-and-other-states#styling-based-on-parent-state
試試這個:
<a class="min-w-full lg:min-w-[0px]" target="_blank" href="https://stackoverflow.com">
<button type="button" class="group border-4 border-github rounded-[12px] min-w-full lg:min-w-[0px] mx-1 mb-4 lg:mb-2 py-2 hover:bg-github transition duration-200 ease-in-out">
<span class="w-full h-full select-none text-github text-2xl lg:text-3xl lg:px- [6.625rem] font-semibold group-hover:text-background transition duration-100"> check this out </span>
</button>
</a>
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/406456.html
標籤:
上一篇:Swift的String檔案中的“SwiftareUnicodecorrectandlocaleinsensitive”是什么意思?
下一篇:如何制作全高的背景影像
