Hide cursor in Chrome (and IE)

后端 未结 6 1955
南笙
南笙 2021-02-04 04:09

I have the following CSS that hides the mouse cursor for anything on the web page. It works perfectly in Firefox, but in IE and Chrome, it doesn\'t work.

html {
         


        
6条回答
  •  忘掉有多难
    2021-02-04 04:45

    I had the same problem in these days and found a good solution to hide the pointer in Google Chrome.

    This is the W3C definition of url property:

    A comma separated of URLs to custom cursors. Note: Always specify a generic cursor at the end of the list, in case none of the URL-defined cursors can be used

    So, you can define a url to not completely transparent image, followed by the default pointer:

    cursor: url(img/almost_transparent.png), default;
    

    If you choose a totally transparent png, Chrome will display a black rectangle instead, but if you choose a png with at least 1px not transparent it will work, and nobody will notice the pointer.

提交回复
热议问题