Why is the hand cursor not showing in anchor tag when hovered?
HtmlHtml Problem Overview
I have this markup, a label wrapped in an anchor tag, but the problem is the cursor when you hover this doesn't change to the hand cursor,
<a href="#17">
<label class="autor">
<span class="by">
by
</span>
Erwin Lutzer
</label>
</a>
what am i doing wrong here?
can anyone plz help, thanks!!
Html Solutions
Solution 1 - Html
The label is cancelling out the pointer, so make sure your CSS has cursor: pointer;
for both the a and the label:
a,
a label {
cursor: pointer;
}
Or better yet, remove the label! It's not valid to have a label inside an anchor.
Solution 2 - Html
Not the answer for actual question, but solution to my own, similar problem:
hand cursor is not showing when hover link. The problem was in the lack of href attribute.
<a>Link</a> <!-- regular cursor -->
but
<a href="#">Link</a> <!-- cursor pointer -->
Solution 3 - Html
There's no reason to put a label
element in a a
element. The label
element is here to decorate an input. There's no way for this label
to be semantically correct inside a link. As you didn't specify a for
attribute linking to an input, there is no reason for it to show the behavior of an activable element.
Don't use CSS here to add a cursor, this would be semantically incorrect. Replace your label with a span
.
Solution 4 - Html
Use this piece of css on your label
:
Css code:
label.autor{
cursor:pointer;
}
Solution 5 - Html
As stated by others, it is not valid to put a label inside an anchor tag, but if you really want to do it add the following css code to solve your problem:
a label { cursor: pointer; }
Normally you use a label to point to a specific input field so when you click on the label the input field gets focused. Since you don't reference to an input field the label isn't really useful within the anchor tag.
Solution 6 - Html
After updating my MacBook to High Sierra 10.13.6 I had to restart to get pointer cursors in any browser back to work.