CSS Reference ยท Scrolling, Interaction and UI
The cursor property
Reference for the CSS cursor property: every standard cursor keyword, custom image cursors with fallbacks, a live gallery and usage and accessibility notes.
The cursor property chooses the mouse pointer shown while it is over an element. The right cursor is a small hint about what will happen: a hand for something clickable, an I-beam for text, a "not allowed" sign for something disabled.
You can pick from a list of standard keywords, or supply your own image with url(). Always end the list with a keyword, which is the fallback if the images fail to load.
button { cursor: pointer; } .drawing { cursor: url("pen.png") 2 2, crosshair; }
Try it
Syntax
cursor: [ <url> [ <x> <y> ]? , ]* <keyword>;
- Initial value:
auto - Applies to: all elements
- Inherited: yes
- Animatable: no
- Computed value: as specified, with URLs made absolute
Values
| Value | Description |
|---|---|
auto |
The browser picks a cursor from the context, such as an I-beam over text. |
default |
The standard arrow. |
none |
Hides the cursor. |
pointer |
A hand, for links and buttons. |
text, vertical-text |
An I-beam for editable or selectable text. |
help, wait, progress |
A question mark, a busy cursor, and a busy cursor that still allows interaction. |
crosshair, cell |
A precision cross and a spreadsheet-cell cursor. |
move, grab, grabbing |
Moving things: a four-way arrow, an open hand and a closed hand. |
not-allowed, no-drop |
The action is forbidden or a drop is not allowed. |
copy, alias, context-menu |
Drag-and-drop and menu hints. |
zoom-in, zoom-out |
A magnifier with a plus or minus sign. |
all-scroll |
Scrolling in any direction. |
n-resize, e-resize, ew-resize, ns-resize, nesw-resize, nwse-resize, col-resize, row-resize and others |
Resize cursors for edges, corners and table columns or rows. |
url(...) x y |
A custom image, with an optional hotspot given as two numbers. Add a keyword fallback after a comma. |
Usage notes
- Use
pointeron elements that act like links or buttons, but not on every element with a click handler by habit; real<button>and<a href>elements do not get it by default, and many design systems leave them asdefaulton purpose. cursor: not-allowedon disabled controls explains why a click does nothing. Pair it with properdisabledoraria-disabledmarkup, since the cursor alone tells keyboard and touch users nothing.- Because the property is inherited, a cursor set on a container applies to all its children unless they set their own.
- Custom cursor images should be small. Browsers limit the size (commonly 128 by 128 pixels), and larger images may be ignored.
- Hiding the cursor with
noneis risky, as people can lose track of the pointer. Use it only for full-screen media or games. - The cursor has no effect on touch screens, which have no pointer.
- The
cursordoes not affect what an element does; it is a visual hint only.
Browser support
The classic keywords work everywhere. The less common ones and the cursor images vary by operating system, so check a compatibility table and always list a keyword fallback.
Related
pointer-eventsโ make an element ignore the pointeruser-selectโ whether text can be selectedtouch-actionโ touch gestures- Lesson: Overflow