How To Change The Cursor On Hovering In CSS? Last Updated : 09 Sep, 2024 Comments Improve Suggest changes Like Article Like Report 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 changing the cursor on hovering in CSS:Table of ContentUsing CSS cursor PropertyChanging Cursor with JavaScriptUsing CSS Cursor PropertyIn this approach, we will use the CSS cursor property which is the simplest and most common way to change the cursor style. This property allows us to define the appearance of the cursor on hover, such as changing it to a pointer, crosshair, or wait symbol.Example: In this example, we are using the CSS cursor property to change the cursor on hovering in CSS. In this, there are three types of text having three different ways of hovering. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Cursor Property</title> <style> .pointer { cursor: pointer; } .text { cursor: text; } .move { cursor: move; } h3 { color: green; } </style> </head> <body> <h3>Welcome to GeeksForGeeks</h3> <div class="pointer"> Hover over me for pointer cursor</div> <div class="text"> Hover over me for text cursor</div> <div class="move"> Hover over me for move cursor</div> </body> </html> Output:Output using CSS Cursor PropertyChanging Cursor with JavaScriptIn this approach we will use change the cursor style dynamically using JavaScript. This method is useful when we want to change the cursor based on some user interaction or event.Example: In below example we are changing the cursor style dynamically using the JavaScript. In this, the way in which the text is being hovered gets changed. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>JavaScript Cursor</title> </head> <body> <div id="jsCursor">Hover over me to change cursor</div> <script> const div = document. getElementById('jsCursor'); div.addEventListener ('mouseover', function () { div.style.cursor = 'crosshair'; }); div.addEventListener ('mouseout', function () { div.style.cursor = 'default'; }); </script> </body> </html> Output:Output of Changing Cursor using JavaScript Comment More infoAdvertise with us Next Article How To Change The Cursor On Hovering In CSS? G ghuleyogesh Follow Improve Article Tags : Web Technologies CSS Similar Reads 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 t 2 min read How to Change the Border Color on Hover in CSS ? Border color in CSS defines the color of an elementâs border. You can change the border color on hover using the :hover pseudo-class, allowing you to modify the borderâs appearance when a user hovers over the element. Using CSS hover Pseudo ClassThe hover pseudo-class in CSS is a powerful tool that 1 min read How to Change the Color of Link on Hover using CSS ? Changing the color of a link on hover can provide visual feedback to users, indicating that the link is interactive. It improves the user experience by helping users understand that the link is clickable. These are the following approaches: Table of Content Using CSS pseudo-classUsing CSS VariablesU 2 min read How to Change the Item Color of List on Hover ? In CSS, we can customize the interaction with the list element by changing the color of the list item on hover. We can also apply the different colors to each item using the :hover pseudo class in CSS. Approach: Using the :hover Pseudo-classIn this approach, we are using the :hover pseudo-class in C 2 min read How to Change Image on hover with CSS ? To change an image on hover with CSS, use the :hover pseudo-class on the image element and alter its properties, such as background-image or content, to display a different image when hovered over. Here are some common approaches to changing the image on hover: Table of Content Using Background Imag 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 2 min read How to Change the Mouse Cursor in Windows? The mouse cursor is an essential element of the Windows user interface, serving as the primary point of interaction between you and your computer. While the default cursor may get the job done, personalizing it can enhance your computing experience, making it more enjoyable and efficient. Table of C 4 min read How to Change Image Opacity on Hover using CSS ? Changing the opacity of an image on hover can add a more elegant and interactive effect to your website. This simple yet effective technique can be implemented using CSS. When a user hovers over an image, it gradually becomes more transparent, pointing out the interaction and creating an attractive 2 min read How to Change Image on Hover using Tailwind CSS? One common effect is changing an image when the user hovers over it. We use Tailwind CSS, a utility-first CSS framework, to accomplish this without any additional JavaScript logic for the hover effect. By utilizing Tailwind's built-in classes we can create smooth transitions between two images where 2 min read How to change the width on hover using Tailwind CSS ? In this article, we will change the width on hover using Tailwind. There is no inbuilt method in Tailwind, so you have to customize the tailwind.config.js file. Let's discuss the whole process further in this article.By default, tailwind CSS only generates responsive variants for width utilities. To 3 min read Like