Reputation: 13947
I was just using some javascript the other day, and previously, the only way I knew how to get it to display the cursor was to do this:
<a href="javascript:" onClick="myfunction()"></a>
But I decided to find some other ways to do it. Not wanting to have my css messy and all over the place, I added this to my stylesheet:
a{
cursor:pointer
}
I'm not styling non-link anchors anywhere else. Is it okay to style non-link anchors?
Or is there a way I should being doing it with javascript that's better then the two ways listed above.
Upvotes: 0
Views: 197
Reputation: 4530
Hey some browsers call the cursor a pointer, others call it a hand (forgot which ones which). So what you have to do is
.pointable
{
cursor: pointer;
cursor: hand;
}
Edit:
I like to make a css style called pointable and applying it to whatever elements I want pointable.
<div class="box pointable rounded">dggf</div>
<a class="pointable">sdds</a>
Upvotes: 1
Reputation: 2282
All <a>
tags should have an href
attribute even if it is blank or says javascript:;
.
So I recommend option 1.
Upvotes: 0
Reputation: 70528
As long as this does not get in the way of how you style the <a>
tag anywhere else on your page this is the best way to do it.
Upvotes: 1