Cursor
The cursor
CSS property sets the appearance of the mouse cursor.
Basic Concepts
Custom Cursors
You can specify zero or more custom cursors using url(...)
.
For each one, you can optionally specify <x>
AND <y>
values (ranging from 0 to 32) which determines the cursor "hotspot" coordinate
(the coordinate of the cursor that interacts with elements).
div {
cursor: url(cursor1.png);
cursor: url(cursor1.png) 1 1;
}
Cursor Keywords
When specifying the value of cursor
, you will always specify one of these mandatory cursor keywords as the last value (after listing custom cursors):
Keyword | Preview / Description |
---|---|
General | |
auto | Let the browser decide automatically depending on the context |
none | Don't display the cursor |
default | ![]() |
pointer | ![]() |
not-allowed | ![]() |
Selection | |
text | ![]() |
vertical-text | ![]() |
crosshair | ![]() |
cell | ![]() |
Drag & Drop | |
move | ![]() |
grab | ![]() |
grabbing | ![]() |
no-drop | ![]() |
Resizing & Scrolling | |
all-scroll | ![]() |
col-resize | ![]() |
row-resize | ![]() |
n-resize | ![]() |
e-resize | ![]() |
s-resize | ![]() |
w-resize | ![]() |
ne-resize | ![]() |
nw-resize | ![]() |
se-resize | ![]() |
sw-resize | ![]() |
ns-resize | ![]() |
ew-resize | ![]() |
nesw-resize | ![]() |
nwse-resize | ![]() |
Zooming | |
zoom-in | ![]() |
zoom-out | ![]() |
Others | |
context-menu | ![]() |
help | ![]() |
alias | ![]() |
copy | ![]() |
progress | ![]() |
wait | ![]() |
CSS Properties
cursor
Sets the appearance of the cursor property. Specify:
- zero or more
url(...)
orurl(...) <x> <y>
(each one representing link to custom cursor and the cursor's hotspot coordinate) - AND one cursor keyword (e.g.
pointer
)
div {
cursor: pointer;
cursor: url(hand.cur), pointer;
cursor: url(cursor1.png) 4 12, auto;
}
References
- cursor (MDN) — https://developer.mozilla.org/en-US/docs/Web/CSS/cursor