views:

1174

answers:

5

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 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.

+4  A: 

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

Kyle Sevenoaks
Thanks the .cur file worked perfectly
Chris
+1  A: 

Since cursor can be given a url to use, could you use a url to a blank image?

graphicdivine
Doesn't seem to work with an image. I tried pointing it to a 16x16 .png file I had (which was visible) just to see if I could change it, it didn't seem to work though. Maybe .cur files only?
Chris
+1  A: 

According to this answer to an similar question, you need to set the height of your document to 100%, otherwise the page will still show the default cursor.

Anyway, it's still bad practise to hide the cursor from the user. You don't want to confuse the user into thinking their mouse device stopped working once they enter your page. Not sure why you would want to hide the cursor, but there are always more user-friendly solutions to what you are trying to achieve here. For instance, if you want to prevent the user from clicking on something, you could prevent the cursor to turning into a hand (* { cursor: pointer; }). If it's some Flash performance issue you are trying to solve, then hiding the cursor will not work, because the browser will still detect mouse movements.

Prutswonder
I need to hide the cursor as this webpage is being used as a non-interactive display. No one will ever nagivate or use the web page it is simply being used as a pretty screen to show information to shoppers in a store.
Chris
Oh and I tried setting height to 100% but it didnt work...
Chris
In your case, leave the mouse cursor as it is. If there is not visible feedback in your page, then the user will focus on the information. Hiding the cursor lets the user focus on the disappearing cursos instead of the page, and you don't want that, right? ;-)
Prutswonder
Our client wants it removed, so I'm removing it lol :)
Chris
A: 

Use a hidden applet with the java.awt.robot class to move the cursor off the sreen. Say the very lower left corner.

dmase
Wow... I can't think of a harder and more complicated way to accomplish such a simple task.
maisteri
+1  A: 

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.

alexmeia