Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the cursor to change to the hand when hovering a <button> tag

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; } 
like image 631
Matt Murphy Avatar asked Jan 06 '12 17:01

Matt Murphy


People also ask

How do you change the cursor into a hand when a user hovers over a list item?

Use CSS property to create cursor to hand when user hovers over the list of items. First create list of items using HTML <ul> and <li> tag and then use CSS property :hover to cursor:grab; to make cursor to hand hover the list of items.

How will you change the pointer icon when it goes over an a tag?

The default cursor for a hyperlink is "pointer". To change it, you need to specify the cursor type for your <a> element with the CSS :hover selector.

What is the pointing hand cursor called?

Link Pointer The link pointer looks like a hand with a pointing finger.


1 Answers

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" /> 
like image 60
Thomas Avatar answered Oct 16 '22 23:10

Thomas