99

I set cursor: pointer for .about > span, but when my mouse hovers on those texts in <span>, the cursor does not change into pointer mode. I would like to know why it is not working.

HTML:

 <div id="firstdiv">
      <div id="intro">
          <h1 id="name">YOU CHIA LAI</h1>
              <ul>
                  <li class="about">I am a Master of <span>Architecture</span>  
                   candidate at Rice University.  
                  </li>
                  <li class="about">I am also interested in <span>photography</span> &        
                  <span>web design</span>.</li>
                  <li class="about">I wish you can know more <span>about</span> me.
                  </li>
             </ul>
      </div>
  </div>

CSS:

#firstdiv {
    position:fixed;
    top:0;
    left:0;
    right:0;
    height:100%;
    width:100%;
    margin:auto;
    background:#E6E6E6;
    text-align:center;
    font-size:0;
    z-index:-2
}
.about > span {
    cursor:pointer;
    font-family:Eurofurence Light;
    padding:0 0 3px 0;
    color:#01DFA5;
}
TylerH
  • 20,799
  • 66
  • 75
  • 101
You Chia Lai
  • 1,035
  • 1
  • 7
  • 6
  • 3
    Remove `z-index:-2` from `#firstdiv` and have a look at [why you shouldn't just paste a link to your demo page](http://meta.stackexchange.com/q/125997/217025). – Marcel Gwerder Aug 25 '13 at 23:14
  • 1
    Strangely worked with me, would be something with `z-index`, in which browser this failure happens? +1 for @MarcelGwerder – Protomen Aug 25 '13 at 23:17
  • The answer below fixed this for me, but closing and reopening chrome. – Bogomip May 10 '22 at 05:57

19 Answers19

483

I messed with my css for hours, changing the positioning and z-index of just about every element on the page. I deleted every other element from the DOM except for the one with the cursor: pointer on hover, and it STILL didn't work.

For me, on Mac OSX El Captain V 10.11, the issue had to do with some sort of interference with Photoshop CC. Once I closed Photoshop, the cursor started working again.

Solution for me: Close and reopen Photoshop

Apparently this can happen due to many different programs including Photoshop, Sketch, DataGrip, Acrobat, Sublime Text, etc.

ThinkingInBits
  • 10,792
  • 8
  • 57
  • 82
  • 5
    This was happening to me in all browsers in OS X (chrome, safari, firefox). Started closing programs, one by one, until I found out that it was Sublime Text 3 in full-screen mode on a second screen that was causing this issue to happen. This answer, however, has nothing to do with original question. – eballeste Jun 12 '17 at 21:46
  • 16
    I saw this highly-upvoted solution and thought it was some kind of mistake because what does another program have to do with my CSS in the browser not working correctly. But, sure enough, closing Photoshop (2022 version in my case) immediately resolved the issue. Glad I tried this before going down an unnecessary CSS tweaking rabbit hole. – MT3 Dec 08 '21 at 03:45
  • 1
    Thank you so much, this has been bugging me for years! Closing Photoshop helped! – Stephan Wagner Feb 07 '22 at 14:37
  • 1
    I had the same issue right now with all my browsers, and Photoshop was the culprit! Terrible coding from Adobe! Thanks for submitting this answer, as it was driving me round the bend! – BobbyMick Apr 21 '22 at 15:08
  • 8
    In all my years of coding, this is the weirdest bug I've ever encountered. Thanks for the fix! – p_mcp Apr 28 '22 at 23:39
  • Whoaaa! I can't believe this! Same here, I resolved the problem by closing Photoshop (thank you for this hint, it really saved me a ton of time!). Just an additional piece of information on top of your comment: the issue is happening on June 2022 with Photoshop `23.3.1`, and Google Chrome `102.0.5005.61` on a MacOS Monterey `12.4`. After closing and reopening Photoshop, the problem doesn't show again. – Marcos Buarque Jun 13 '22 at 16:38
  • 5
    Can't believe this is still a bug in 2022. I can confirm that closing and re-opening Photoshop solved the issue on Macbook Pro (M1 chip) – Botond Kopacz Jun 27 '22 at 19:33
  • 3
    Holy crap, this just happened to me on my MBP M1 Max. Was driving me crazy! Thank you! – jkchu Aug 09 '22 at 22:46
  • I thought I was losing my mind. THANK YOU!!! – smb Oct 18 '22 at 19:04
  • This did not work for me. I closed Sublime 3 (and Affinity Photo and a few others), no change. Seriously puzzling. – cbmtrx Oct 24 '22 at 13:51
  • Man this was crazy! I was actually thinking "I can't believe I'm googling something so simple - it's definitely just some rogue element on the page" but glad I did now! – FlyingKitlets Jan 04 '23 at 18:48
  • 2
    Still true in Feb 2023... Shame on you Adobe! – Joeri Feb 06 '23 at 15:39
  • 1
    Can't believe there's such type of bug. I fixed this issue after closing Photoshop and Illustrator. My machine is MBP M1 Pro. Wow. Thanks for saving my time. – Will Kim Mar 11 '23 at 07:11
  • again saved my ass! – Kevin Vugts Apr 28 '23 at 23:39
  • 1
    Dear lord, I've been trying to add a cursor on a box for hours... stupid photoshop messing everything up. *facepalm* – Renegade_Mtl May 09 '23 at 13:24
  • A good ol' restarting my computer fixed it for me. – Tony Jara Jun 14 '23 at 14:43
  • 1
    That is completely crazy! – Starfs Jun 15 '23 at 20:37
121

You need to change the z-index so that #firstdiv is considered on top of the other divs.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Sj.
  • 1,402
  • 1
  • 12
  • 9
41

Just happened to me, and in my case it was due to a CSS rule pointer-events: none; which was set on a parent element and I forgot about it.

This caused any pointer events to be just ignored, which includes the cursor.

To fix this, you can just set the style to allow pointer events:

.about>span{
    cursor:pointer;
    pointer-events: auto;
}

Or directly in the element:

<span style="pointer-events: auto;">...</span>
Shadow The GPT Wizard
  • 66,030
  • 26
  • 140
  • 208
36

cursor:pointer doesn't work when you're using Chrome's mobile emulator.

enter image description here

0xcaff
  • 13,085
  • 5
  • 47
  • 55
  • 5
    I believe that's intentional or at least expected behavior as there is no cursor on a mobile device, except perhaps for text selection and that's OS dependent and not sure you can override that. – Kasapo Jan 24 '18 at 19:13
  • 1
    I had the same issue once in chrome (But not in mobile emulator). So i turn "mobile emulator" on and off and chrome get back to the right stage. ;-D – Rzassar Apr 23 '19 at 09:26
7

Also add cursor:hand. Some browsers need that instead.

H2ONOCK
  • 956
  • 1
  • 5
  • 19
  • 21
    [Are you really talking and caring about IE 5/5.5?](http://quirksmode.org/css/user-interface/cursor.html#t013) – Marcel Gwerder Aug 25 '13 at 23:22
  • 6
    Or hybrid browsers which have been based around IE5...like used in some large companies. Have I really been voted down 3 times for this!? Not impressed really, shame on Stack Overflow. – H2ONOCK Sep 04 '13 at 09:52
7
position: relative;
z-index: 2;
cursor: pointer

worked for me.

Thomas
  • 119
  • 1
  • 4
3

For the last few hours, I was scratching my head why my CSS wasn't working! I was trying to show row-resize as cursor but it was showing the default cursor but for s-resize browser was showing the correct cursor. I tried changing z-index but that also didn't solve my problem.

So after trying few more solutions from the internet, I called one of my co-workers and shared my screen via Google meet and he told me that he was seeing the row-resize icon when I was seeing the default icon!!! He even sent me the screenshot of my screencast.

So after further investigation, I found out the as I was using Remote Desktop Connection to connect to my office PC, for some reason RDC doesn't show some type of cursors.

Here is the list of cursor's I couldn't see on my remote PC,

none, cell, crosshair, text, vertical-text, alias, copy, col-resize, row-resize,

2

It works if you remove position:fixed from #firstdiv - but @Sj is probably right as well - most likely a z-index layering issue.

Brad Peabody
  • 10,917
  • 9
  • 44
  • 63
1

I had this issue using Angular and SCSS. I had all my CSS nested so I decided to remove cursor: pointer; out of it. And it worked.

Example:

.container{
  .Approved{
    color:green;
  }

  .ApprovedAndVerified{
    color:black;
  }

  .lock_button{
    font-size:35px;
    display:block;
    text-align:center;
  }
}

.lock_button{
  cursor:pointer;
}
JuZDePeche
  • 679
  • 5
  • 15
0

The problem in my case was that the :after blocked mouse events, so I had to add pointer-events: none; to my :after block.

franiis
  • 1,378
  • 1
  • 18
  • 33
0

I have the same issue, when I close the chrome window popup browser inspector its working fine for me.

Rijo
  • 2,963
  • 5
  • 35
  • 62
0

The solution that worked for me is using forward slash instead of backslash when 'calling' out from a local directory.

instead of backslash:

cursor: url("C:\Users\Ken\projects\JavascriptGames\images\bird.png"), auto;
Note: When I use backslash I am getting a net::ERR_FILE_NOT_FOUND

I changed it to forwardslash:

cursor: url("C:/Users/Ken/projects/JavascriptGames/images/bird.png"), auto;
Note: When I use forward slash, the custom cursor style executes successfully.

This behavior regarding backslashes and forward slashes could probably be explained in this StackOverflow answer: Strange backslash and behavior in CSS

Lan
  • 5
  • 3
0

My problem was using cursor: 'pointer' mistakenly instead of cursor: pointer. So, make sure you are not adding single or double quotes around pointer.

Saber
  • 2,440
  • 1
  • 25
  • 40
0

For me, the issue was that I had this set globally:

::-webkit-scrollbar {
  display: none;
}

After removing this, cursor: pointer works as expected.

zMan
  • 3,229
  • 2
  • 15
  • 6
0

Remove parent z-index value fixed the issue for me.

dealwap
  • 621
  • 2
  • 14
  • 33
0

Whatever you do, the cursor will not change unless you set the style against :hover

this needs to be as follows, in addition to the class you already have for the elements.

.about > span:hover {
    cursor:pointer;
}
Mostafa
  • 111
  • 2
  • 12
-1

I found a solution: use :hover with cursor: pointer if nothing else helps.

Artem
  • 1
  • 1
  • 1
-1

Prevent user from selecting text, then use curser:pointer property -

.targeted-span{
user-select: none;
curser : pointer;}
-2

Position the element as relative and then use z-index

.menu-toggle{ 
    display: block; 
    width: 40px; 
    height: 40px; 
    border:2px solid white; 
    border-radius: 5px; 
    margin: 15px; 
    float: right; 
    cursor: pointer; 
    text-align: center; 
    font-size: 30px; 
    color: var(--light-bg-color); 
    z-index: 10; 
}
Machavity
  • 30,841
  • 27
  • 92
  • 100
Ian paul
  • 29
  • 1