I have a list with clickable <li>
elements, but the mouse shows a text cursor on hover.
How can I apply the proper CSS cursor hand style so the pointer changes to a hand, similar to how it behaves over buttons or links?
I have a list with clickable <li>
elements, but the mouse shows a text cursor on hover.
How can I apply the proper CSS cursor hand style so the pointer changes to a hand, similar to how it behaves over buttons or links?
You just need to set cursor: pointer; on the
li {
cursor: pointer;
}
That’ll give you the hand-style pointer when hovering, just like on links and buttons.
Ah, I ran into this exact issue! If you’ve made your <li>
tags clickable (like with JavaScript), browsers don’t automatically treat them like buttons or anchors.
So yeah, manually add cursor: pointer;
to your list item style. It’s simple but makes a huge difference for UX.