我开始学习Tailwind CSS,并尝试实现下面的按钮。这是一个空白按钮,悬停时突出显示其底部边框。
然而,通过扫描文件,我似乎无法重现的效果。
q0qdq0h21#
<script src="https://cdn.tailwindcss.com"></script> <div class="flex items-center justify-center min-h-screen"> <button class="text-6xl font-bold transition duration-150 border-b-8 border-transparent hover:border-purple-500"> Button </button> </div>
oyxsuwqo2#
First, add the following to your tailwind.config.js.
module.exports = { variants: { extend: { // ... borderStyle: ['hover'], } } }
Then use the following utilities to create the button.
<button class="p-4 font-bold font-sans border-b-2 border-double border-transparent hover:border-current cursor-pointer select-none"> Button </button>
Finally, run npm run prod .
npm run prod
bybem2ql3#
您可以使用transition class.并检查https://tailwindcss.com/docs/transition-property中的transition文档
3条答案
按热度按时间q0qdq0h21#
oyxsuwqo2#
First, add the following to your tailwind.config.js.
Then use the following utilities to create the button.
Finally, run
npm run prod
.bybem2ql3#
您可以使用transition class.并检查https://tailwindcss.com/docs/transition-property中的transition文档