Hide cursor in Chrome (and IE)

37,577

Solution 1

This property cursor:none; isn't part of the standard

See here w3c cursor CSS properties.

You might want to look into hiding it with Javascript or JQuery.

Also, look at blank cursor files here.

And one last link to an ajax solution.

Chrome has had this issue since it was built, there have been reports sent to the people at Chromium, and I assume they are working on it.

Also, don't trust that anything would work in IE. Ever. :P

Solution 2

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.

Solution 3

Finding something that works across browsers is a pain.

The code below works on Chrome, IE, and Firefox. IE likes .cur files, Chrome likes the embedded png, and some browsers actually respect the none :)

div {
    cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjbQg61aAAAADUlEQVQYV2P4//8/IwAI/QL/+TZZdwAAAABJRU5ErkJggg=='),
    url(images/blank.cur),
    none;
}
Share:
37,577
Chris
Author by

Chris

Updated on July 09, 2022

Comments

  • Chris
    Chris almost 2 years

    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 {
        cursor: none;
    }
    

    In Chrome, I always see the mouse pointer. In IE, however, I see whatever cursor was last 'active' when it entered the screen. Presumably it's keeping the last selection instead of removing it.

  • samulisoderlund
    samulisoderlund almost 14 years
    Wow... I can't think of a harder and more complicated way to accomplish such a simple task.
  • trusktr
    trusktr over 12 years
    Just to let you know Chrome supports "cursor: none;" and IE supports fully transparent cursors. You can use browser specific stylesheets. ;)
  • alexmeia
    alexmeia over 12 years
    Thank you for the comment. At the time of my answer Chrome didn't support cursor:none
  • Charlie Schliesser
    Charlie Schliesser over 12 years
    I +1 this. It's not a simple task. cursor:none; does "work" in Chrome, but if you click the left mouse button the cursor reappears. If you try and drag, the cursor reappears. If you are able to do something like open-and-close the inspector, the cursor reappears. There are lots of ways to get it back. This solution is the kind of thing that provides permanent cursor removal, should your application require it.
  • Chris
    Chris almost 11 years
    From the website: This is an experimental technology == Not good for users with slightly older browsers
  • RandallB
    RandallB almost 11 years
    Correct. It's great though for other specific use cases. (Kiosk-ey touchscreens)
  • a.barbieri
    a.barbieri almost 7 years
    Could get it to work on IE and Edge (via browserstack)
  • Glenn Maynard
    Glenn Maynard almost 6 years
    Pointer lock is definitely the wrong thing to do if you just want to hide the mouse.