Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I've got a list, and I have a click handler for its items:

<ul>   <li>foo</li>   <li>goo</li> </ul> 

How can I change the mouse pointer into a hand pointer (like when hovering over a button)? Right now the pointer turns into a text selection pointer when I hover over the list items.

like image 922
user246114 Avatar asked Jun 21 '10 19:06

user246114


People also ask

How do I make a cursor hand in HTML?

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.

What is the hand cursor called?

It is also called a pointer, but today pointer refer to a specific cursor, the one that looks like a hand with an extended index finger.

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.


2 Answers

In light of the passage of time, as people have mentioned, you can now safely just use:

li { cursor: pointer; } 
like image 64
Aren Avatar answered Sep 30 '22 21:09

Aren


Use for li:

li:hover {     cursor: pointer; } 

See more cursor properties with examples after running snippet option:

An animation showing a cursor hovering over a div of each class

.auto          { cursor: auto; }  .default       { cursor: default; }  .none          { cursor: none; }  .context-menu  { cursor: context-menu; }  .help          { cursor: help; }  .pointer       { cursor: pointer; }  .progress      { cursor: progress; }  .wait          { cursor: wait; }  .cell          { cursor: cell; }  .crosshair     { cursor: crosshair; }  .text          { cursor: text; }  .vertical-text { cursor: vertical-text; }  .alias         { cursor: alias; }  .copy          { cursor: copy; }  .move          { cursor: move; }  .no-drop       { cursor: no-drop; }  .not-allowed   { cursor: not-allowed; }  .all-scroll    { cursor: all-scroll; }  .col-resize    { cursor: col-resize; }  .row-resize    { cursor: row-resize; }  .n-resize      { cursor: n-resize; }  .e-resize      { cursor: e-resize; }  .s-resize      { cursor: s-resize; }  .w-resize      { cursor: w-resize; }  .ns-resize     { cursor: ns-resize; }  .ew-resize     { cursor: ew-resize; }  .ne-resize     { cursor: ne-resize; }  .nw-resize     { cursor: nw-resize; }  .se-resize     { cursor: se-resize; }  .sw-resize     { cursor: sw-resize; }  .nesw-resize   { cursor: nesw-resize; }  .nwse-resize   { cursor: nwse-resize; }    .cursors > div {      float: left;      box-sizing: border-box;      background: #f2f2f2;      border:1px solid #ccc;      width: 20%;      padding: 10px 2px;      text-align: center;      white-space: nowrap;      &:nth-child(even) {         background: #eee;      }      &:hover {         opacity: 0.25      }  }
<h1>Example of cursor</h1>    <div class="cursors">      <div class="auto">auto</div>      <div class="default">default</div>      <div class="none">none</div>      <div class="context-menu">context-menu</div>      <div class="help">help</div>      <div class="pointer">pointer</div>      <div class="progress">progress</div>      <div class="wait">wait</div>      <div class="cell">cell</div>      <div class="crosshair">crosshair</div>      <div class="text">text</div>      <div class="vertical-text">vertical-text</div>      <div class="alias">alias</div>      <div class="copy">copy</div>      <div class="move">move</div>      <div class="no-drop">no-drop</div>      <div class="not-allowed">not-allowed</div>      <div class="all-scroll">all-scroll</div>      <div class="col-resize">col-resize</div>      <div class="row-resize">row-resize</div>      <div class="n-resize">n-resize</div>      <div class="s-resize">s-resize</div>      <div class="e-resize">e-resize</div>      <div class="w-resize">w-resize</div>      <div class="ns-resize">ns-resize</div>      <div class="ew-resize">ew-resize</div>      <div class="ne-resize">ne-resize</div>      <div class="nw-resize">nw-resize</div>      <div class="se-resize">se-resize</div>      <div class="sw-resize">sw-resize</div>      <div class="nesw-resize">nesw-resize</div>      <div class="nwse-resize">nwse-resize</div>  </div>
like image 27
Santosh Khalse Avatar answered Sep 30 '22 21:09

Santosh Khalse