Change cursor to hand when mouse goes over a row in table

后端 未结 11 1917
暗喜
暗喜 2020-12-22 22:59

How do I change the cursor pointer to hand when my mouse goes over a in a

相关标签:
11条回答
  • 2020-12-22 23:42

    For compatibility with IE < 6 use this style in that order:

    .sortable:hover {
        cursor: pointer;
        cursor: hand;
    }
    

    But remember that IE < 7 supports :hover pseudoclass only with <a> element.

    0 讨论(0)
  • 2020-12-22 23:43

    for just a standard the above solutions work, but if you are using datatables, you have to override the default datatatables.css settings and add the following code to custom css, In the code below row-select is the class that I added on datatables as shown in the html.

    table.row-select.dataTable tbody td
    {
    cursor: pointer;    
    }
    

    And you html will look as below:

    <table datatable="" dt-options="dtOptions1" dt-columns="dtColumns1" class="table table-striped table-bordered table-hover row-select"  id="datatable"></table>
    
    0 讨论(0)
  • 2020-12-22 23:44

    You can do this with CSS actually.

    .sortable tr {
        cursor: pointer;
    }
    
    0 讨论(0)
  • 2020-12-22 23:49

    Use the CSS cursor property like so:

    <table class="sortable">
      <tr>
        <th class="tname">Name</th><th class="tage">Age</th>
      </tr>
      <tr style="cursor: pointer;"><td class="tname">Jennifer</td><td class="tage">24</td></tr>
      <tr><td class="tname">Kate</td><td class="tage">36</td></tr>
      <tr><td class="tname">David</td><td class="tage">25</td></tr>
      <tr><td class="tname">Mark</td><td class="tage">40</td></tr>
    </table>
    

    Of course you should put the style into your CSS file and apply it to the class.

    0 讨论(0)
  • 2020-12-22 23:50

    I've searched bootstrap styles a bit and found this:

    [role=button]{cursor:pointer}
    

    So I assume you can get what you want with:

    <span role="button">hi</span>
    
    0 讨论(0)
  • 2020-12-22 23:50

    I added this to my style.css to manage cursor options:

    .cursor-pointer{cursor: pointer;}
    .cursor-croshair{cursor: crosshair;}
    .cursor-eresize{cursor: e-resize;}
    .cursor-move{cursor: move;}
    
    0 讨论(0)
提交回复
热议问题