The Wayback Machine - https://web.archive.org/web/20240930214718/https://www.geeksforgeeks.org/css-cursor-property/
Open In App

CSS Cursor Property

Last Updated : 17 Sep, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

CSS Cursor is used to specify the mouse cursor to be displayed while pointing to an element. This property is defined with zero or more <url> values that are separated by commas followed by 1 keyword value as mandatory & each <url> will point to the image file.

Syntax: 

cursor: value;

CSS Cursor Property Values

Here’s a more readable version of the cursor properties with a table-like structure for better clarity:

Cursor PropertyDescription
autoThe default cursor is where the browser automatically sets it.
aliasIndicates that an alias (shortcut) is being created.
all-scrollIndicates that the entire element can be scrolled.
cellIndicates the user is selecting a cell or set of cells.
context-menuSuggests that a context menu is available.
col-resizeIndicates that the column can be resized horizontally.
copyShows that something is to be copied.
crosshairDisplays a crosshair cursor.
defaultThe default system cursor, typically an arrow.
e-resizeIndicates that the edge of a box is to be moved to the right.
ew-resizeSuggests a bidirectional resize left-right.
helpIndicates that help or additional information is available.
moveUsed when something is draggable or can be moved.
n-resizeIndicates that the edge of a box is to be moved upwards.
ne-resizeThe edge of a box is moved up and right.
nesw-resizeBidirectional resize in north-east and south-west directions.
ns-resizeSuggests a bidirectional resize vertically (up-down).
nw-resizeThe edge of a box is moved up and left.
nwse-resizeA bidirectional resize in north-west and south-east directions.
no-dropIndicates that a dragged item cannot be dropped here.
noneNo cursor is displayed.
not-allowedIndicates that the requested action cannot be executed.
pointerRepresents a pointer, typically used for hyperlinks.
progressIndicates that the system is busy but interactive.
row-resizeShows that the row can be resized vertically.
s-resizeIndicates that the edge of a box is to be moved downwards.
se-resizeThe edge of a box is moved down and right.
sw-resizeThe edge of a box is moved down and left.
textThe text cursor indicates text that can be selected.
URLAllows custom cursors from a list of comma-separated URLs.
vertical-textShows vertical text that can be selected.
w-resizeIndicates that the edge of a box is to be moved left.
waitSuggests the system is busy and the user should wait.
zoom-inIndicates that something can be zoomed in.
zoom-outIndicates that something can be zoomed out.
initialResets the cursor to its initial (default) value.
inheritThe cursor is inherited from the parent element.

Example: This example illustrates the use of the cursor property & its value is set to wait which indicates that the program is busy.

HTML
<!DOCTYPE html>
<html>
<head>
    <title> CSS | cursor property </title>
    <style>
    .wait {
        cursor: wait;
    }
    
    h1 {
        color: green;
    }
    </style>
</head>

<body>
    <center>
        <h1>GeeksforGeeks</h1>
        <p>Mouse over the words to change the mouse cursor.</p>

        <p class="wait">wait</p>

    </center>
</body>
</html>

Output: 

Supported Browsers

  • Google Chrome 1.0
  • Microsoft Edge 12.0
  • Mozilla Firefox 1.0
  • IE 4.0
  • Opera 7.0
  • Safari1.2

Note: Keep in mind that some older versions of browsers, especially Internet Explorer, may not fully support all modern CSS properties and features. Testing for compatibility across multiple versions is recommended.

CSS Cursor Property FAQs

How do I customize my cursor in CSS?

You can customize your cursor using the cursor property in CSS, and set it to values like pointer, default, or even a custom image with url().

What is a hand cursor called?

The hand cursor is called pointer in CSS, commonly used for links and clickable elements.

Can we change cursor color in CSS?

No, you cannot directly change the cursor color in CSS. However, you can create a custom cursor using an image that includes your desired color.

When to use cursor pointer in CSS?

Use the cursor: pointer when you want to indicate that an element is clickable, such as buttons or links.

How to turn off the cursor in CSS?

You can turn off the cursor by setting cursor: none;, which will hide the cursor for the selected element.



Previous Article
Next Article

Similar Reads

What is the Cursor Property in CSS?
The cursor property in CSS is used to specify the type of cursor to be displayed when the mouse pointer is over an element. It allows you to enhance the user experience by indicating the expected interaction or action when interacting with different elements on a webpage. Note: The cursor property can take various values, representing different cur
1 min read
HTML | DOM Style cursor Property
The cursor property is used in HTML DOM to set or return the type of cursor to display for the mouse pointer. Syntax: Return the cursor property:object.style.cursorSet the cursor property:object.style.cursor=value Property Values: alias: This property is used to display the cursor's indication of something is to be created.all-scroll: In this prope
4 min read
jQWidgets jqxSortable cursor Property
jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful and optimized framework, platform-independent, and widely supported. jqxSortable represents a jQuery plugin which allows you to reorder elements in a html list or div tags using the mouse. The cursor property is used to define the
2 min read
JavaScript Cursor Property
Style.cursor specifies the mouse cursor to be displayed when pointing over an element. Syntax:object.style.cursor = "cursorValue";Some important mouse pointers are as follows: waithelpmovepointercrosshaircellnoneExample 1: This example shows the use of the JavaScript cursor property. [GFGTABS] HTML <html> <head> <title> JavaScript
2 min read
How to change cursor color using CSS ?
In this article, we will see how to change the cursor color in the input fields using CSS. To change the cursor color, we will use caret-color property. This property is used to set the color of the cursor for input fields, textarea, or other editable areas. Syntax: caret-color: auto|color; Parameters: auto: It has a default value. It uses the curr
2 min read
How to set cursor style that indicates any direction scroll using CSS ?
In this article, we will see how to set the cursor style for any direction using CSS. This style can be created by using all-scroll cursor property. This property sets the cursor that it indicates any direction scroll using CSS. The all-scroll property value indicates that something can be scrolled in any direction. Syntax: cursor: all-scroll; Exam
1 min read
How to set the cursor style on browser using CSS ?
The cursor property in CSS is used to specify the type of mouse cursor to be displayed when pointing over an element. By default, all the browser's cursor is set to the pointer. And if we want to customize it, we can do it with the help of CSS. By default, the value of the cursor property is set to 'auto'. Also, mentioning the value auto to the cur
1 min read
Hide the cursor in a webpage using CSS and JavaScript
In this article, we are going to learn how to Hide the cursor on a webpage using CSS and JavaScript. ApproachFirst, select the element where the cursor element needs to hide.Add CSS style cursor: none to the class.Add the class name (class name of CSS style cursor: none) to the particular element where the cursor element is to be hidden.Example 1:
2 min read
How to Change the Cursor Shape in CSS?
In this article, we will change the Cursor Shape in CSS. The cursor property is used to change the cursor shape. This property allows you to specify the type of cursor that should be displayed when the mouse pointer is over an element. Using the cursor PropertyThe cursor property is used to change the cursor shape. There are various predefined curs
2 min read
How to Change the Cursor into a Hand Pointer on Hover over list using CSS
CSS offers a powerful property called "cursor" that controls the appearance of the mouse pointer when hovering over specific HTML elements. By assigning different values to this property, you can customize the cursor's behaviour. In our case, we'll be using the value "pointer" to trigger the classic hand icons. This slight visual cue plays a signif
2 min read
Tailwind CSS Cursor
Tailwind CSS offers various utility classes to set the mouse cursor appearance when pointing at an element. These classes correspond to the CSS cursor property, allowing you to quickly specify the cursor type without writing custom CSS Cursor Classes:ClassDescriptioncursor-autoDefault cursor set by the browser.cursor-defaultDefault cursor appearanc
2 min read
How to create custom cursor using CSS ?
A custom cursor enhances the readability of the document and grabs the user's attention to a specific part of the webpage. Today we are going to learn how to create a custom cursor for a webpage using HTML, CSS, and JavaScript. Approach: Hide the default cursor.Define the classes which contain all the animations.Add and remove these classes dynamic
2 min read
How to Build Animated Cursor Neon using HTML, CSS and JavaScript?
The neon cursor moves with your mouse, creating a cool visual effect. You can change the neon color to match your website. You can also adjust how bright and wide the neon glow is to fit your style. You can transform your cursor into a bright neon trail. You can choose different colors, adjust the glow, and set the trail length. It's perfect for da
2 min read
Design Smiley Face Eyes that follow Mouse Cursor using CSS and JS
An animated face by using HTML and CSS and JavaScript. Where the face will follow the cursor. It is one of the simple CSS and JavaScript effects. For a beginner, it is one of the best examples to learn the concept of pseudo-elements. Approach: The Basic idea of a face is comes from CSS.Here the whole animation will be made by CSS and a little bit o
5 min read
How To Change The Cursor On Hovering In CSS?
Changing the cursor style when a user hovers over a particular element is a common user experience enhancement in web development. The default cursor is usually a pointer (arrow) but CSS allows us to change the cursor to various shapes such as a hand (for links), text selection, or even custom icons. PrerequisitesHTMLCSSThese are the approaches for
2 min read
p5.js cursor() Function
The cursor() function in p5.js is used to set the cursor to a predefined symbol or an image or it makes visible if already hidden. To set an image as the cursor, the recommended size is 16x16 or 32x32 pixels. The values for parameters x and y must be less than the dimensions of the image. Syntax: cursor(type, x, y) Parameters: This function accepts
1 min read
How to change cursor style using jQuery ?
The cursor style is used to specify the mouse cursor to be displayed while pointing on an element. Cursor Value: alias: This property is used to display the cursor’s indication of something is to be created. all-scroll: In this property, the cursor indicates scrolling. auto: This is the default property where the browser sets a cursor. cell: In thi
5 min read
How to set cursor style to pointer for links without href ?
Method 1: Using a CSS class for the links A CSS class is created that changes the cursor property. The cursor property is used to specify the mouse cursor to be displayed when the mouse is pointed over an element. Using the 'pointer' value in this property will change the cursor to a 'pointer' indicating a link. This class can then be used on any l
2 min read
How to set cursor position in content-editable element using JavaScript ?
In order to set caret cursor position in content editable elements like div tag is carried over by JavaScript Range interface. The range is created using document.createRange() method. Approach 1: First, create Range and set position using above syntax. Get user input from input tag using jQuery $("input']").val(); On button click assign input valu
4 min read
How to use font awesome icon as a cursor ?
Making a simple cursor look like a car, a beverage, an emoji or any other shape or symbol looks fascinating. We can actually change the cursor to any font awesome icon on the webpage. To add any font awesome icon to the cursor, we need to add the font-awesome CDN inside the header section. There is a CSS cursor property to change the type of a curs
2 min read
How to insert text into the textarea at the current cursor position?
To insert text into the textarea/inputbox at the current cursor position we need to get the current position of the cursor. So here the approach to get the current position of the cursor. First, get the current position of cursor with the help of property named as selectionStart on textarea/inputbox.To insert the text at the given position we will
2 min read
jQuery UI Sortable Cursor Option
jQuery UI Sortable Widget cursor Option is used to define the cursor that is being shown while sorting the elements. Learn more about jQuery here. Syntax: $( ".selector" ).sortable({ cursor: "move" }); Approach: First, add jQuery UI scripts needed for your project. <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.cs
1 min read
How does Query.prototype.cursor() work in Mongoose?
The Query.prototype.cursor() function returns a wrapper around a MongoDB driver cursor. And this function triggers the pre find hooks, not the post find hooks.Syntax: Query.prototype.cursor() Parameters: This function has one optional parameter i.e. transform which is an optional function which accepts a mongoose document.Return Value: This functio
2 min read
jQuery UI Draggable cursor Option
The jQuery UI consists of GUI widgets, visual effects, and themes implemented using jQuery, CSS, and HTML. jQuery UI is great for building UI interfaces for the webpages. The jQuery UI Draggable cursor Option is used to change the CSS cursor during the drag operation. Syntax: $( ".selector" ).draggable({ cursor: "crosshair" }); CDN Link: First, add
1 min read
How to set the cursor to wait in JavaScript ?
In JavaScript, we could easily set the cursor to wait. In this article, we will see how we are going to do this. Actually, it's quite an easy task, there is a CSS cursor property and it has some values and one of the values is wait. We will use the [cursor: wait] property of CSS and control its behavior using JavaScript. Setting the cursor to the w
3 min read
How to set cursor in search form by clicking on button in jQuery ?
Given a search form, we need to set the cursor in the search form on clicking a button using jQuery. This can be done by using the focus() method and click() method. We will create a web page with a textbox and a button. We will add the functionality using jQuery such that on clicking the button, the cursor is set to the textbox. Now let us discuss
2 min read
React Suite Popover Follow Cursor
React suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we’ll learn about React suite Popover Follow Cursor. The popover is used to show the popup informa
3 min read
React Suite Tooltip Follow Cursor
React suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we’ll learn about React suite Tooltip Follow Cursor. The tooltip component allows users to display
3 min read
Mongoose Aggregate.prototype.cursor() API
The Aggregate API.prototype.cursor() method of the Mongoose API is used to perform aggregation tasks. It allows us to iterate the result set. Aggregation cursor object allows us to perform iteration task on each document object in result set one by one. Syntax: aggregate(...).cursor( options ) Parameters: This method accepts a single parameter as d
3 min read
Custom Cursor Using React Js
In this article, We will create a Custom Cursor using React JS. Our project aims to develop a unique­ cursor that will replace the standard mouse pointer with a personalize­d design. This innovative cursor will adapt its appearance­ according to the user's interactions. Preview of final output: Let us have a look at how the final output will look l
4 min read