assign color to mouse cursor using CSS

前端 未结 4 1224
迷失自我
迷失自我 2020-12-03 10:51

How can I assign color to the mouse cursor in a web-page?

Can anyone suggest me a way to do it using any of the technologies e.g. HTML, CSS, JavaScript?

4条回答
  •  悲&欢浪女
    2020-12-03 11:31

    Use an image along with CSS cursor property, I don't see any need of JavaScript heere...

    Demo

    div {
       cursor: url(YOUR_IMAGE_URL), auto;
    }
    

    As commented, I've used auto which is nothing but default cursor just incase your image fails to load, exactly like we declare multiple font families.

提交回复
热议问题