115

When viewing my site, the cursor only changes to the gloved hand for <a> tags, not <button> tags. Is there a reason for this?

Here is my code (the button tags have an id of #more in css3).

 #more {
    background:none;
    border:none;
    color:#FFF;
    font-family:Verdana, Geneva, sans-serif;
}
Wesley Murch
  • 101,186
  • 37
  • 194
  • 228
Matt Murphy
  • 1,529
  • 4
  • 16
  • 17
  • There are [reasons](https://medium.com/simple-human/buttons-shouldnt-have-a-hand-cursor-b11e99ca374b) for that. And history if you follow links. Modifying current default cursor styles set by vendors isn't necessary (if you design well your buttons and use the correct element, either a or submit or button) – FelipeAls Sep 07 '18 at 09:40

4 Answers4

150

see: https://developer.mozilla.org/en-US/docs/Web/CSS/cursor

so you need to add: cursor:pointer;

In your case use:

#more {
  background:none;
  border:none;
  color:#FFF;
  font-family:Verdana, Geneva, sans-serif;
  cursor:pointer;
}

This will apply the curser to the element with the ID "more" (can be only used once). So in your HTML use

<input type="button" id="more" />

If you want to apply this to more than one button then you have more than one possibility:

using CLASS

.more {
  background:none;
  border:none;
  color:#FFF;
  font-family:Verdana, Geneva, sans-serif;
  cursor:pointer;
}

and in your HTML use

<input type="button" class="more" value="first" />
<input type="button" class="more" value="second" />

or apply to a html context:

input[type=button] {
  background:none;
  border:none;
  color:#FFF;
  font-family:Verdana, Geneva, sans-serif;
  cursor:pointer;
}

and in your HTML use

<input type="button" value="first" />
<input type="button" value="second" />
Suraj Jain
  • 4,463
  • 28
  • 39
Thomas
  • 2,345
  • 1
  • 18
  • 17
  • 1
    Link in answer seems dead. – Pang Oct 20 '15 at 04:48
  • 1
    I think the link should be https://wiki.selfhtml.org/wiki/CSS/Eigenschaften/Benutzeroberfl%C3%A4che/cursor, but I am not sure. Maybe @Thomas can help? – MERose Feb 17 '16 at 20:49
  • 1
    The selector for all selecting button input elements (`input[type=text]`) is incorrect. This should be: `input[type=button]`. – Patrick Jun 26 '17 at 14:20
32

Just add this style:

cursor: pointer;

The reason it's not happening by default is because most browsers reserve the pointer for links only (and maybe a couple other things I'm forgetting, but typically not <button>s).

More on the cursor property: https://developer.mozilla.org/en/CSS/cursor

I usually apply this to <button> and <label> by default.

NOTE: I just caught this:

the button tags have an id of #more

It's very important that each element has it's own unique id, you cannot have duplicates. Use the class attribute instead, and change your selector from #more to .more. This is actually quite a common mistake that is the cause of many problems and questions asked here. The earlier you learn how to use id, the better.

Wesley Murch
  • 101,186
  • 37
  • 194
  • 228
10

All u need is just use one of the attribute of CSS , which is---->

cursor:pointer

just use this property in css , no matter its inline or internal or external

for example(for inline css)

<form>
<input type="submit" style= "cursor:pointer" value="Button" name="Button">
</form>
Aashish
  • 767
  • 8
  • 4
3
 #more {
    background:none;
    border:none;
    color:#FFF;
    font-family:Verdana, Geneva, sans-serif;
    cursor: pointer;
}
Lem Ko
  • 413
  • 4
  • 13