CSS cursor Property

You are Here:

Demo

alias
all-scroll
auto
cell
context-menu
col-resize
copy
crosshair
default
e-resize
ew-resize
grab
grabbing
help
move
n-resize
ne-resize
nesw-resize
ns-resize
nwse-resize
no-drop
none
not-allowed
pointer
progress
row-resize
s-resize
se-resize
sw-resize
text
url("desktop.png"), auto
vertical-text
w-resize
wait
zoom-in
zoom-out

CSS cursor Property

CSS cursor property specifies the mouse cursor to be displayed when pointing over an element.

Example

HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h2>CSS cursor Property</h2> <p style="cursor:alias;">alias</p> <p style="cursor:all-scroll;">all-scroll</p> <p style="cursor:auto;">auto</p> <p style="cursor:cell;">cell</p> <p style="cursor:context-menu;">context-menu</p> <p style="cursor:col-resize;">col-resize</p> <p style="cursor:copy;">copy</p> <p style="cursor:crosshair;">crosshair</p> <p style="cursor:default;">default</p> <p style="cursor:e-resize;">e-resize</p> <p style="cursor:ew-resize;">ew-resize</p> <p style="cursor:grab;">grab</p> <p style="cursor:grabbing;">grabbing</p> <p style="cursor:help;">help</p> <p style="cursor:move;">move</p> <p style="cursor:n-resize;">n-resize</p> <p style="cursor:ne-resize;">ne-resize</p> <p style="cursor:nesw-resize;">nesw-resize</p> <p style="cursor:ns-resize;">ns-resize</p> <p style="cursor:nwse-resize;">nwse-resize</p> <p style="cursor:no-drop;">no-drop</p> <p style="cursor:none;">none</p> <p style="cursor:not-allowed;">not-allowed</p> <p style="cursor:pointer;">pointer</p> <p style="cursor:progress;">progress</p> <p style="cursor:row-resize;">row-resize</p> <p style="cursor:s-resize;">s-resize</p> <p style="cursor:se-resize;">se-resize</p> <p style="cursor:sw-resize;">sw-resize</p> <p style="cursor:text;">text</p> <p style="cursor:url('/desktop.png'), auto;">url("desktop.png"), auto</p> <p style="cursor:vertical-text;">vertical-text</p> <p style="cursor:w-resize;">w-resize</p> <p style="cursor:wait;">wait</p> <p style="cursor:zoom-in;">zoom-in</p> <p style="cursor:zoom-out;">zoom-out</p> </body> </html>

Syntax

Using CSS

element{ cursor: not-allowed; }

Using Javascript

object.style.cursor="not-allowed";

Animatable

No, cursor property is not animatable. CSS Animatable Properties Reference.

Default Value

Default value for CSS cursor property is auto.

Property Value

The following table provides a list of values for CSS cursor property.

ValueExplanation
aliasAn alias or shortcut is to be created.
all-scrollThe cursor indicates that something can be scrolled in any direction
autoEquivalent to 'text' when hovering text otherwise 'context-menu'. Default value.
cellThe cursor indicates that the table cell or set of cells can be selected.
context-menuThe cursor indicates that the context menu is available.
col-resizeThe cursor indicates that the item/column can be resized horizontally.
copyThe cursor indicates that something is to be copied.
crosshairCross cursor, often used to indicate selection in a bitmap.
defaultThe default cursor
e-resizeThe cursor indicates that an edge of a box is to be moved right (east).
ew-resizeThe cursor indicates a bidirectional resize cursor pointing towards east-west.
grabThe cursor indicates that something can be grabbed
grabbingThe cursor indicates that something can be grabbed
helpThe cursor indicates that help is available
moveThe cursor indicates that the element is to be moved.
n-resizeThe cursor indicates that an edge of a box is to be moved up (north)
ne-resizeThe cursor indicates that an edge of a box is to be moved up and right (north/east)
nesw-resizeBidirectional resize cursor.
ns-resizeThe cursor indicates that an edge of a box is to be moved up and down (north/south)
nwse-resizeBidirectional resize cursor.
no-dropAn item may not be dropped at the current location.
noneNo cursor is rendered.
not-allowedThe cursor indicates that the requested action will not be carried out.
pointerA pointing hand indicates a link.
progressThe cursor indicates that the program is busy in the background, but the user can still interact with the interface.
row-resizeThe cursor indicates that the row can be resized vertically.
s-resizeThe cursor indicates that an edge of a box is to be moved down (south)
se-resizeThe cursor indicates that an edge of a box is to be moved down and right (south-east).
sw-resizeThe cursor indicates that an edge of a box is to be moved down and left (south-west)
textThe cursor indicates text that may be selected
URLUse image file for cursor pointer. A comma separated list of URLs to custom cursors.
vertical-textThe cursor indicates vertical-text that may be selected
w-resizeThe cursor indicates that an edge of a box is to be moved left (west).
waitThe cursor indicates that the program is busy
zoom-inThe cursor indicates that something can be zoomed in
zoom-outThe cursor indicates that something can be zoomed out

Using JavaScript

In the following example, we will demonstrate how to change the CSS cursor property of an element using JavaScript.

Example

HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h2>CSS cursor Property</h2> <div id="point"> Move your mouse pointer over this div. </div> <button onclick="myFunction()">Click Me</button> <script> function myFunction(){ var x = document.getElementById("point"); x.style.cursor = "not-allowed" } </script> </body> </html>

Reminder

Hi Developers, we almost covered 98.7% of CSS Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in CSS.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author