cursor

Sets the appearance of the mouse cursor over an element.

Initial value
auto
Inherited
Yes
Animatable
no
Applies to
all elements
JavaScript
element.style.cursor = "pointer"
On this page

Example

#
CSS
.card[role="button"] {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}
Preview

Definition and usage

#

The cursor property changes the shape of the cursor when the pointer is over an element. The cursor is an important cue: a hand (pointer) says “you can click here”, an I-beam (text) says “you can select text here”, and a crossed-out circle (not-allowed) says “this action is unavailable”.

Buttons and links have the appropriate cursors by default. Set a custom cursor for elements that behave like buttons but aren’t, and for special zones such as dragging (grab, grabbing).

You can also use your own image: cursor: url(cursor.png) 4 4, auto. The numbers are the image’s hotspot, and after the comma you give a fallback cursor.

Syntax

#
Syntax
cursor: auto | default | pointer | text | move | grab | not-allowed | wait | help | … | url(…) x y, <cursor>;

Values

#
  • pointer

    A hand, a signal that the element is clickable.
  • text

    A text I-beam, as over a text field.
  • grab

    An open hand, the element can be dragged.
  • not-allowed

    A crossed-out circle, the action is unavailable.
  • wait

    An hourglass or loading spinner.
  • zoom-in

    A magnifier with a plus, clicking will enlarge the image.

Values in practice

#

pointer

A hand, a signal that the element is clickable.
.demo { cursor: pointer; }

text

A text I-beam, as over a text field.
.demo { cursor: text; }

grab

An open hand, the element can be dragged.
.demo { cursor: grab; }

not-allowed

A crossed-out circle, the action is unavailable.
.demo { cursor: not-allowed; }

wait

An hourglass or loading spinner.
.demo { cursor: wait; }

zoom-in

A magnifier with a plus, clicking will enlarge the image.
.demo { cursor: zoom-in; }

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • Don’t switch the cursor to pointer on elements that do nothing when clicked. It is misleading.
  • Touch screens have no cursor, so don’t use it to convey important information.

Related entries

#

Practise it in lessons

#

Spotted a mistake or missing an example? Write to us.