152

I'm trying to disable a specific link and apply cursor style but this CSS command cursor: text; won't effect. The cursor is always default. I'm using latest Firefox version.

CSS:

pointer-events: none !important;
cursor: text;
color: Blue;
Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
Dragut
  • 1,747
  • 3
  • 12
  • 15
  • @PHPglue Two things: http://www.w3fools.com and it really doesn't work, even when it's just this element in the page: http://jsfiddle.net/brh9r8h6/ – emerson.marini Sep 03 '14 at 22:13

7 Answers7

172

Using pointer-events: none will disable all mouse interactions with that element. If you wanted to change the cursor property, you would have to apply the changes to the parent element. You could wrap the link with an element and add the cursor property to it.

Example Here

HTML

<span class="wrapper">
    <a href="#">Some Link</a>
</span>

CSS

.wrapper {
    position: relative;
    cursor: text;  /* This is used */
}
.wrapper a {
    pointer-events: none;
}

There are a few browser inconsistencies, though. To make this work in IE11, it seems like you need a pseudo element. The pseudo element also allows you to select the text in FF. Oddly enough, you can select the text in Chrome without it.

Updated Example

.wrapper:after {
    content: '';
    position: absolute;
    width: 100%; height: 100%;
    top: 0; left: 0;
}
Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
  • your code works unless i delete its parent tags, but it is in
  • and in this case it is still default cursor
– Dragut Sep 03 '14 at 22:40
  • @user3721912 Do you mind providing an example? That would be helpful. – Josh Crozier Sep 03 '14 at 22:42
  • yes that is exactly what i want to say, i mean my span tag stays not alone it has
  • parents,it is encircled with
  • tags
  • – Dragut Sep 03 '14 at 22:50