1

I have a really big project where I need to change all the cursor: pointer to a custom pointer

Here's how the normal pointer looks:

enter image description here

One way to do it is to create a class like the following in CSS and apply it to every element in html where the custom pointer is supposed to appear:

.custom-pointer {
    cursor: url("../img/custom-pointer-cursor.png"), auto;
}

The problem though is that that pointer is supposed to appear in a 100+ places in the project and I was wondering if there is a way to just override cursor: pointer with my custom pointer with only a couple of lines of code in css.

I have looked on the web but have not found anything similar to what I want to do.

4
  • Do u want that image on the cursor? Commented Aug 13, 2019 at 11:07
  • What about using tag selectors?? like "button, input[type='submit']" Commented Aug 13, 2019 at 11:10
  • 1
    @jo12345678 please check below answer, thank you ! Commented Aug 13, 2019 at 11:15
  • 1
    Any halfway decent IDE should have functionality to do a search & replace over all project files … so replacing cursor: pointer with cursor: url(…), auto; should not be that big of a deal to begin with. (And if the use of white space isn’t that consistent across the project, a regular expression search should be able to handle that as well.) Commented Aug 13, 2019 at 11:16

1 Answer 1

3

Basically we use pointer on anchors and buttons, if there is something else where you need custom cursor, I think you can use following code:

a,button{
 cursor: url("../img/custom-pointer-cursor.png"), auto;
}

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.