Change the Mouse Cursor in CSS With the cursor Property

cursor is used to change the mouse cursor on specific elements. This is especially useful in web apps where different tasks can be done other than clicking. This obviously only works when there's a pointing device:

.in-progress {
  cursor: progress;
}

Available Cursors

Hover over the following to see the different cursors available if you’re on a desktop/laptop computer:

General/Default Cursors

auto
default
none
pointer

Scroll Cursor

all-scroll

Status Cursors

context-menu
help
wait
progress

Selection Cursors

crosshair
cell
text
vertical-text

Drag & Drop Cursors

alias
copy
move
no-drop
not-allowed

Zoom Cursors

zoom-in
zoom-out

Grab Cursors

grab
grabbing

Resizing Cursors

e-resize
n-resize
ne-resize
nw-resize
s-resize
se-resize
sw-resize
w-resize
ew-resize
ns-resize
nesw-resize
nwse-resize
col-resize
row-resize

Custom Cursors

You can define custom cursors. Note that not all browsers support svg files for cursors, and .cur files are supported across the board, so it can be a good idea to provide a .cur fallback if you want to use an svg cursor. You can also provide a fallback to one of the non-custom cursors.

You can define a custom position for the cursor hotspot by adding x & y coordinates for where the hotspot should be in the provided custom image.

Note that, when using svg cursors, it’s important that your svg has width & height values on the root svg element, or else your cursor won’t show. In the following example, our svg file (chef.svg) starts like this:

<svg height="32" width="32"...
.custom-cur {
  cursor: url('/images/chef.svg');
}

/* With a .cur fallback */
.custom-cur {
  cursor: url('/images/chef.svg'),
  url('/images/chef.cur');
}

/* With a custom hotspot */
.custom-cur {
  cursor: url('/images/chef.svg') 10 12;
}

/* With a non-custom fallback: */
.custom-cur {
  cursor: url('/images/chef.svg'),
  move;
}

Here’s a button with our custom cursor: chef-cur.svg

Browser Support

Can I Use css3-cursors? Data on support for the css3-cursors feature across the major browsers from caniuse.com.

  Tweet It
✖ Clear

🕵 Search Results

🔎 Searching...