How to create Custom Cursor using CSS

We can create a custom cursor image with extensions like .cur (for Internet Explorer), .gif and .png (for Chrome, Firefox, Safari) and apply it to an element using the CSS cursor property and setting it to a url and in addition a generic cursor value such as auto,default, pointer, etc.


Selector {
   cursor: url("/*path to custom cursor file*/"), generic cursor;


Let’s see how to create custom cursor with an example −

 Live Demo

<!DOCTYPE html>
<title>Custom Cursor Using CSS</title>
form {
   margin: 0 auto;
   text-align: center;
* {
   padding: 2px;
input[type="button"] {
   border-radius: 10px;
#tech1 {
   cursor: url(""), auto;
#tech2 {
   cursor: url(""), auto;
<legend>Custom Cursor Using CSS</legend>
<input type="button" id="tech1" value="DBMS">
<input type="button" id="tech2" value="Python">


Following is the output for the above code −

Hovering over ‘DBMS’ button −

Hovering over ‘Python’ button −

Updated on: 07-Jan-2020


Kickstart Your Career

Get certified by completing the course

Get Started