Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tailwind - Links do not have the default cursor pointer on hover

Tags:

tailwind-css

We use Tailwind CSS in our project. Any <a href*> tag should by default change the mouse pointer to cursor:pointer. In our normal HTML designs, this works fine, but when converted to ReactJS, all links display the normal cursor, and not the pointer.

So, I want to force the cursor:pointer to a-href elements in the Tailwind output style.css. I tried:

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
    a {
        @apply cursor-pointer;
    }
}

That did not work. When inspecting any link element in chrome, I do not see cursor: pointer in the css for <a href*> tags.

chrome styles

This is weird because I fiddled in the tailwind playground and it worked, but not in my project: https://play.tailwindcss.com/d3rpFZd6gM?file=css

like image 432
halkibsi Avatar asked Apr 18 '26 14:04

halkibsi


1 Answers

Have you tried

@tailwind base;
@tailwind components;
@tailwind utilities;

a {
    @apply cursor-pointer;
}
like image 194
Dolgoon Doodii Avatar answered Apr 21 '26 18:04

Dolgoon Doodii



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!