11

I want to prevent the mouse cursor from changing when I move it over some text. Is this possible?

If not, I would like to change the appearance of text-selection cursor - is it possible with css / javascript?

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Jiří Zmrhal
  • 143
  • 1
  • 2
  • 7

3 Answers3

6

Try this...

* {
  -webkit-user-select: none;
}

*:active,
*:hover {
  cursor: pointer;
}
Alex Gill
  • 2,395
  • 1
  • 16
  • 18
  • 1
    The idea of the site is that users have done some research and attempted something before asking questions. This is merely a hint and as relevant as it gets... – Alex Gill Dec 18 '12 at 15:03
  • Thanks, but this doesn't work properly in Chrome - the cursor changes to cursor:text when you want to select some text. – Jiří Zmrhal Dec 18 '12 at 15:55
  • Of course I tried, maybe bad explanation. In Chrome, when you start to select text, or just click and drag with mouse, cursor automaticcaly changes to "text-selection" cursor. How to prevent it? – Jiří Zmrhal Dec 18 '12 at 16:06
  • You could leave off the `*` in your latest examples. – David Thomas Dec 18 '12 at 16:23
  • I need to keep user selection, I only don't want to cursor change - is this possible without disabling user selection? – Jiří Zmrhal Dec 18 '12 at 16:23
  • It appears you cant, even setting an image for the cursor doesnt work cursor: url(https://mail.google.com/mail/images/2/openhand.cur), pointer !important; – Alex Gill Dec 18 '12 at 17:05
5

Nobody feels like explicitly setting the cursor for each element, even if that only entails adding a class. That's a lot of hand work.

It would be wiser to:

* {
cursor: inherit;
}

body {
cursor: default;
}

This will disable the text selection cursor for any element, but won't interfere with any other CSS or scripts that change the cursor-property for certain elements.

Luke
  • 409
  • 3
  • 12
4

I think you are lookings for is the css property "cursor:default;" - but this really depends on what exactly you are looking for. Example with a label:

label{
    cursor:default;
}

Depending on the cursor you want, you can change the value from "default" to something else.

Here's a list of some of the values (Not all - but the most common are there): https://developer.mozilla.org/en-US/docs/CSS/cursor

Remember you get different results depending on browser/OS.

NorthCat
  • 9,643
  • 16
  • 47
  • 50
Peter Rasmussen
  • 16,474
  • 7
  • 46
  • 63
  • Thanks for reply, but this is not exactly what I am looking for. Yes, i CAN change a type of the cursor if I move it over some element, for example

    element. BUT, if I start to selecting text, my cursor changes anyway - in Chrome.

    – Jiří Zmrhal Dec 18 '12 at 15:52
  • @JiříZmrhal Sorry I don't think it is possible (misunderstood your question at first), I've searched around the internet(like you probably already have) and found nothing too. I also remembering trying to do this myself with dissappointment. This post draws the same conclusion http://stackoverflow.com/questions/8583785/changing-the-text-selection-cursor - However if youd find an answer, please post it :) – Peter Rasmussen Dec 18 '12 at 16:21
  • Yes, maybe it isn't possible. But I think if disabling of cursor changing while selecting text works in IE, it must work in Chrome too - with text selection enabled, of course :). – Jiří Zmrhal Dec 18 '12 at 16:35
  • 1
    Upvoting because I was looking for a way to make the "text" cursor disappear (I had text on top of a clickable td element, and it was getting in the way). This worked for me. Thanks, Peter. – justian17 Feb 15 '14 at 17:26