我有一个列表,并且有一个点击处理程序:
<ul>
<li>foo</li>
<li>goo</li>
</ul>
如何将鼠标指针更改为手指针(如悬停在按钮上)?现在,当我将鼠标悬停在列表项上时,指针变成了文本选择指针。
我有一个列表,并且有一个点击处理程序:
<ul>
<li>foo</li>
<li>goo</li>
</ul>
如何将鼠标指针更改为手指针(如悬停在按钮上)?现在,当我将鼠标悬停在列表项上时,指针变成了文本选择指针。
当前回答
用于li:
li:hover {
cursor: pointer;
}
运行snippet选项后,通过示例查看更多光标财产:
.auto{cursor:auto;}.default{cursor:默认;}.none{cursor:none;}.上下文菜单{光标:上下文菜单;}.help{光标:帮助;}.pointer{cursor:pointer;}.进度{光标:进度;}.wait{游标:等待;}.cell{光标:单元格;}.croshair{cursor:croshair;}.text{cursor:text;}垂直文本{光标:垂直文本;}.alias{游标:别名;}.copy{cursor:copy;}.move{光标:移动;}.no drop{游标:no drop;}.不允许{游标:不允许;}.all scroll{cursor:all scroll;}.col resize{cursor:col resize;}.row resize{cursor:行大小调整;}.n-resize{cursor:n-resize;}.e-resize{cursor:e-size;}.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;}.new resize{cursor:new resize;}.nwse resize{光标:nwse resize;}.curss>div{浮动:左侧;框大小调整:边框框;背景:;边框:1px实心#ccc;宽度:20%;填充:10px 2px;文本对齐:居中;空白:nowrap;&:第n个孩子(偶数){背景:#eee;}&:悬停{不透明度:0.25}}<h1>光标示例</h1><div class=“cursors”>自动</div><div class=“default”>默认</div><div class=“none”>none</div><div class=“context menu”>上下文菜单</div><div class=“help”>帮助</div><div class=“pointer”>pointer</div>进度</div><div class=“wait”>wait</div><div class=“cell”>单元格</div>十字线</div><div class=“text”>text</div><div class=“vertical text”>垂直文本</div><div class=“alias”>别名</div><div class=“copy”>复制</div><div class=“move”>移动</div><div class=“no drop”>no drop</div><div class=“not allowed”>不允许</div><div class=“all scroll”>所有滚动</div><div class=“col resize”>col resize</div><div class=“row resize”>调整行大小</div><div class=“n-resize”>n-resize</div><div class=“s-resize”>s-resize</div><div class=“e-size”>e-size</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>
其他回答
li:hover {cursor: hand; cursor: pointer;}
用于li:
li:hover {
cursor: pointer;
}
运行snippet选项后,通过示例查看更多光标财产:
.auto{cursor:auto;}.default{cursor:默认;}.none{cursor:none;}.上下文菜单{光标:上下文菜单;}.help{光标:帮助;}.pointer{cursor:pointer;}.进度{光标:进度;}.wait{游标:等待;}.cell{光标:单元格;}.croshair{cursor:croshair;}.text{cursor:text;}垂直文本{光标:垂直文本;}.alias{游标:别名;}.copy{cursor:copy;}.move{光标:移动;}.no drop{游标:no drop;}.不允许{游标:不允许;}.all scroll{cursor:all scroll;}.col resize{cursor:col resize;}.row resize{cursor:行大小调整;}.n-resize{cursor:n-resize;}.e-resize{cursor:e-size;}.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;}.new resize{cursor:new resize;}.nwse resize{光标:nwse resize;}.curss>div{浮动:左侧;框大小调整:边框框;背景:;边框:1px实心#ccc;宽度:20%;填充:10px 2px;文本对齐:居中;空白:nowrap;&:第n个孩子(偶数){背景:#eee;}&:悬停{不透明度:0.25}}<h1>光标示例</h1><div class=“cursors”>自动</div><div class=“default”>默认</div><div class=“none”>none</div><div class=“context menu”>上下文菜单</div><div class=“help”>帮助</div><div class=“pointer”>pointer</div>进度</div><div class=“wait”>wait</div><div class=“cell”>单元格</div>十字线</div><div class=“text”>text</div><div class=“vertical text”>垂直文本</div><div class=“alias”>别名</div><div class=“copy”>复制</div><div class=“move”>移动</div><div class=“no drop”>no drop</div><div class=“not allowed”>不允许</div><div class=“all scroll”>所有滚动</div><div class=“col resize”>col resize</div><div class=“row resize”>调整行大小</div><div class=“n-resize”>n-resize</div><div class=“s-resize”>s-resize</div><div class=“e-size”>e-size</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>
ul li:hover{
cursor: pointer;
}
也可以使用以下样式:
li {
cursor: grabbing;
}
对于完整的跨浏览器,请使用:
cursor: pointer;
cursor: hand;